@@ -10,6 +10,7 @@ use either::Either;
1010use  hir:: OpaqueTyOrigin ; 
1111use  rustc_data_structures:: frozen:: Frozen ; 
1212use  rustc_data_structures:: fx:: { FxIndexMap ,  FxIndexSet } ; 
13+ use  rustc_errors:: ErrorGuaranteed ; 
1314use  rustc_hir as  hir; 
1415use  rustc_hir:: def:: DefKind ; 
1516use  rustc_hir:: def_id:: LocalDefId ; 
@@ -26,6 +27,7 @@ use rustc_middle::mir::tcx::PlaceTy;
2627use  rustc_middle:: mir:: visit:: { NonMutatingUseContext ,  PlaceContext ,  Visitor } ; 
2728use  rustc_middle:: mir:: AssertKind ; 
2829use  rustc_middle:: mir:: * ; 
30+ use  rustc_middle:: traits:: query:: NoSolution ; 
2931use  rustc_middle:: ty:: adjustment:: PointerCast ; 
3032use  rustc_middle:: ty:: cast:: CastTy ; 
3133use  rustc_middle:: ty:: subst:: { SubstsRef ,  UserSubsts } ; 
@@ -41,7 +43,7 @@ use rustc_target::abi::{FieldIdx, FIRST_VARIANT};
4143use  rustc_trait_selection:: traits:: query:: type_op:: custom:: scrape_region_constraints; 
4244use  rustc_trait_selection:: traits:: query:: type_op:: custom:: CustomTypeOp ; 
4345use  rustc_trait_selection:: traits:: query:: type_op:: { TypeOp ,  TypeOpOutput } ; 
44- use  rustc_trait_selection :: traits :: query :: Fallible ; 
46+ 
4547use  rustc_trait_selection:: traits:: PredicateObligation ; 
4648
4749use  rustc_mir_dataflow:: impls:: MaybeInitializedPlaces ; 
@@ -216,24 +218,22 @@ pub(crate) fn type_check<'mir, 'tcx>(
216218    let  opaque_type_values = opaque_type_values
217219        . into_iter ( ) 
218220        . map ( |( opaque_type_key,  decl) | { 
219-             checker
220-                 . fully_perform_op ( 
221-                     Locations :: All ( body. span ) , 
222-                     ConstraintCategory :: OpaqueType , 
223-                     CustomTypeOp :: new ( 
224-                         |ocx| { 
225-                             ocx. infcx . register_member_constraints ( 
226-                                 param_env, 
227-                                 opaque_type_key, 
228-                                 decl. hidden_type . ty , 
229-                                 decl. hidden_type . span , 
230-                             ) ; 
231-                             Ok ( ( ) ) 
232-                         } , 
233-                         "opaque_type_map" , 
234-                     ) , 
235-                 ) 
236-                 . unwrap ( ) ; 
221+             let  _:  Result < _ ,  ErrorGuaranteed >  = checker. fully_perform_op ( 
222+                 Locations :: All ( body. span ) , 
223+                 ConstraintCategory :: OpaqueType , 
224+                 CustomTypeOp :: new ( 
225+                     |ocx| { 
226+                         ocx. infcx . register_member_constraints ( 
227+                             param_env, 
228+                             opaque_type_key, 
229+                             decl. hidden_type . ty , 
230+                             decl. hidden_type . span , 
231+                         ) ; 
232+                         Ok ( ( ) ) 
233+                     } , 
234+                     "opaque_type_map" , 
235+                 ) , 
236+             ) ; 
237237            let  mut  hidden_type = infcx. resolve_vars_if_possible ( decl. hidden_type ) ; 
238238            trace ! ( "finalized opaque type {:?} to {:#?}" ,  opaque_type_key,  hidden_type. ty. kind( ) ) ; 
239239            if  hidden_type. has_non_region_infer ( )  { 
@@ -1134,7 +1134,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
11341134        sup :  Ty < ' tcx > , 
11351135        locations :  Locations , 
11361136        category :  ConstraintCategory < ' tcx > , 
1137-     )  -> Fallible < ( ) >  { 
1137+     )  -> Result < ( ) ,   NoSolution >  { 
11381138        // Use this order of parameters because the sup type is usually the 
11391139        // "expected" type in diagnostics. 
11401140        self . relate_types ( sup,  ty:: Variance :: Contravariant ,  sub,  locations,  category) 
@@ -1147,7 +1147,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
11471147        found :  Ty < ' tcx > , 
11481148        locations :  Locations , 
11491149        category :  ConstraintCategory < ' tcx > , 
1150-     )  -> Fallible < ( ) >  { 
1150+     )  -> Result < ( ) ,   NoSolution >  { 
11511151        self . relate_types ( expected,  ty:: Variance :: Invariant ,  found,  locations,  category) 
11521152    } 
11531153
@@ -1159,7 +1159,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
11591159        user_ty :  & UserTypeProjection , 
11601160        locations :  Locations , 
11611161        category :  ConstraintCategory < ' tcx > , 
1162-     )  -> Fallible < ( ) >  { 
1162+     )  -> Result < ( ) ,   NoSolution >  { 
11631163        let  annotated_type = self . user_type_annotations [ user_ty. base ] . inferred_ty ; 
11641164        trace ! ( ?annotated_type) ; 
11651165        let  mut  curr_projected_ty = PlaceTy :: from_ty ( annotated_type) ; 
@@ -2755,11 +2755,20 @@ impl<'tcx> TypeOp<'tcx> for InstantiateOpaqueType<'tcx> {
27552755/// constraints in our `InferCtxt` 
27562756type  ErrorInfo  = InstantiateOpaqueType < ' tcx > ; 
27572757
2758-     fn  fully_perform ( mut  self ,  infcx :  & InferCtxt < ' tcx > )  -> Fallible < TypeOpOutput < ' tcx ,  Self > >  { 
2759-         let  ( mut  output,  region_constraints)  = scrape_region_constraints ( infcx,  |ocx| { 
2760-             ocx. register_obligations ( self . obligations . clone ( ) ) ; 
2761-             Ok ( ( ) ) 
2762-         } ) ?; 
2758+     fn  fully_perform ( 
2759+         mut  self , 
2760+         infcx :  & InferCtxt < ' tcx > , 
2761+         span :  Span , 
2762+     )  -> Result < TypeOpOutput < ' tcx ,  Self > ,  ErrorGuaranteed >  { 
2763+         let  ( mut  output,  region_constraints)  = scrape_region_constraints ( 
2764+             infcx, 
2765+             |ocx| { 
2766+                 ocx. register_obligations ( self . obligations . clone ( ) ) ; 
2767+                 Ok ( ( ) ) 
2768+             } , 
2769+             "InstantiateOpaqueType" , 
2770+             span, 
2771+         ) ?; 
27632772        self . region_constraints  = Some ( region_constraints) ; 
27642773        output. error_info  = Some ( self ) ; 
27652774        Ok ( output) 
0 commit comments