@@ -45,7 +45,7 @@ use rustc_hir::intravisit::{self, Visitor};
4545use  rustc_hir:: Expr ; 
4646use  rustc_hir_analysis:: astconv:: AstConv ; 
4747use  rustc_infer:: infer:: type_variable:: { TypeVariableOrigin ,  TypeVariableOriginKind } ; 
48- use  rustc_infer:: infer:: { Coercion ,  InferOk ,  InferResult } ; 
48+ use  rustc_infer:: infer:: { Coercion ,  DefineOpaqueTypes ,   InferOk ,  InferResult } ; 
4949use  rustc_infer:: traits:: Obligation ; 
5050use  rustc_middle:: lint:: in_external_macro; 
5151use  rustc_middle:: ty:: adjustment:: { 
@@ -143,11 +143,11 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
143143    fn  unify ( & self ,  a :  Ty < ' tcx > ,  b :  Ty < ' tcx > )  -> InferResult < ' tcx ,  Ty < ' tcx > >  { 
144144        debug ! ( "unify(a: {:?}, b: {:?}, use_lub: {})" ,  a,  b,  self . use_lub) ; 
145145        self . commit_if_ok ( |_| { 
146-             let  at = self . at ( & self . cause ,  self . fcx . param_env ) . define_opaque_types ( true ) ; 
146+             let  at = self . at ( & self . cause ,  self . fcx . param_env ) ; 
147147            if  self . use_lub  { 
148-                 at. lub ( b,  a) 
148+                 at. lub ( DefineOpaqueTypes :: Yes ,   b,  a) 
149149            }  else  { 
150-                 at. sup ( b,  a) 
150+                 at. sup ( DefineOpaqueTypes :: Yes ,   b,  a) 
151151                    . map ( |InferOk  {  value :  ( ) ,  obligations } | InferOk  {  value :  a,  obligations } ) 
152152            } 
153153        } ) 
@@ -175,7 +175,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
175175            // so this will have the side-effect of making sure we have no ambiguities 
176176            // due to `[type error]` and `_` not coercing together. 
177177            let  _ = self . commit_if_ok ( |_| { 
178-                 self . at ( & self . cause ,  self . param_env ) . define_opaque_types ( true ) . eq ( a,  b) 
178+                 self . at ( & self . cause ,  self . param_env ) . eq ( DefineOpaqueTypes :: Yes ,   a,  b) 
179179            } ) ; 
180180            return  success ( vec ! [ ] ,  self . fcx . tcx . ty_error ( guar) ,  vec ! [ ] ) ; 
181181        } 
@@ -1101,9 +1101,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
11011101                    ( ty:: FnDef ( ..) ,  ty:: FnDef ( ..) )  => { 
11021102                        // Don't reify if the function types have a LUB, i.e., they 
11031103                        // are the same function and their parameters have a LUB. 
1104-                         match  self 
1105-                             . commit_if_ok ( |_| self . at ( cause,  self . param_env ) . lub ( prev_ty,  new_ty) ) 
1106-                         { 
1104+                         match  self . commit_if_ok ( |_| { 
1105+                             self . at ( cause,  self . param_env ) . lub ( 
1106+                                 DefineOpaqueTypes :: No , 
1107+                                 prev_ty, 
1108+                                 new_ty, 
1109+                             ) 
1110+                         } )  { 
11071111                            // We have a LUB of prev_ty and new_ty, just return it. 
11081112                            Ok ( ok)  => return  Ok ( self . register_infer_ok_obligations ( ok) ) , 
11091113                            Err ( _)  => { 
@@ -1153,7 +1157,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
11531157            let  sig = self 
11541158                . at ( cause,  self . param_env ) 
11551159                . trace ( prev_ty,  new_ty) 
1156-                 . lub ( a_sig,  b_sig) 
1160+                 . lub ( DefineOpaqueTypes :: No ,   a_sig,  b_sig) 
11571161                . map ( |ok| self . register_infer_ok_obligations ( ok) ) ?; 
11581162
11591163            // Reify both sides and return the reified fn pointer type. 
@@ -1237,7 +1241,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
12371241                ) ; 
12381242
12391243                return  self 
1240-                     . commit_if_ok ( |_| self . at ( cause,  self . param_env ) . lub ( prev_ty,  new_ty) ) 
1244+                     . commit_if_ok ( |_| { 
1245+                         self . at ( cause,  self . param_env ) . lub ( DefineOpaqueTypes :: No ,  prev_ty,  new_ty) 
1246+                     } ) 
12411247                    . map ( |ok| self . register_infer_ok_obligations ( ok) ) ; 
12421248            } 
12431249        } 
@@ -1248,8 +1254,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
12481254                if  let  Some ( e)  = first_error { 
12491255                    Err ( e) 
12501256                }  else  { 
1251-                     self . commit_if_ok ( |_| self . at ( cause,  self . param_env ) . lub ( prev_ty,  new_ty) ) 
1252-                         . map ( |ok| self . register_infer_ok_obligations ( ok) ) 
1257+                     self . commit_if_ok ( |_| { 
1258+                         self . at ( cause,  self . param_env ) . lub ( DefineOpaqueTypes :: No ,  prev_ty,  new_ty) 
1259+                     } ) 
1260+                     . map ( |ok| self . register_infer_ok_obligations ( ok) ) 
12531261                } 
12541262            } 
12551263            Ok ( ok)  => { 
@@ -1487,8 +1495,12 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> {
14871495            assert ! ( expression_ty. is_unit( ) ,  "if let hack without unit type" ) ; 
14881496            fcx. at ( cause,  fcx. param_env ) 
14891497                // needed for tests/ui/type-alias-impl-trait/issue-65679-inst-opaque-ty-from-val-twice.rs 
1490-                 . define_opaque_types ( true ) 
1491-                 . eq_exp ( label_expression_as_expected,  expression_ty,  self . merged_ty ( ) ) 
1498+                 . eq_exp ( 
1499+                     DefineOpaqueTypes :: Yes , 
1500+                     label_expression_as_expected, 
1501+                     expression_ty, 
1502+                     self . merged_ty ( ) , 
1503+                 ) 
14921504                . map ( |infer_ok| { 
14931505                    fcx. register_infer_ok_obligations ( infer_ok) ; 
14941506                    expression_ty
0 commit comments