@@ -19,7 +19,7 @@ use rustc_middle::ty::layout::ValidityRequirement;
1919use rustc_middle:: ty:: {
2020 self , AdtDef , AliasTy , AssocItem , AssocKind , Binder , BoundRegion , FnSig , GenericArg , GenericArgKind ,
2121 GenericArgsRef , GenericParamDefKind , IntTy , ParamEnv , Region , RegionKind , TraitRef , Ty , TyCtxt , TypeSuperVisitable ,
22- TypeVisitable , TypeVisitableExt , TypeVisitor , UintTy , Upcast , VariantDef , VariantDiscr ,
22+ TypeVisitable , TypeVisitableExt , TypeVisitor , UintTy , Upcast , VariantDef , VariantDiscr , TypingMode ,
2323} ;
2424use rustc_span:: symbol:: Ident ;
2525use rustc_span:: { DUMMY_SP , Span , Symbol , sym} ;
@@ -268,7 +268,7 @@ pub fn implements_trait_with_env_from_iter<'tcx>(
268268 return false ;
269269 }
270270
271- let infcx = tcx. infer_ctxt ( ) . build ( ) ;
271+ let infcx = tcx. infer_ctxt ( ) . build ( TypingMode :: from_param_env ( param_env ) ) ;
272272 let args = args
273273 . into_iter ( )
274274 . map ( |arg| arg. into ( ) . unwrap_or_else ( || infcx. next_ty_var ( DUMMY_SP ) . into ( ) ) )
@@ -362,7 +362,7 @@ fn is_normalizable_helper<'tcx>(
362362 }
363363 // prevent recursive loops, false-negative is better than endless loop leading to stack overflow
364364 cache. insert ( ty, false ) ;
365- let infcx = cx. tcx . infer_ctxt ( ) . build ( ) ;
365+ let infcx = cx. tcx . infer_ctxt ( ) . build ( TypingMode :: from_param_env ( param_env ) ) ;
366366 let cause = ObligationCause :: dummy ( ) ;
367367 let result = if infcx. at ( & cause, param_env) . query_normalize ( ty) . is_ok ( ) {
368368 match ty. kind ( ) {
@@ -1268,7 +1268,7 @@ pub fn make_normalized_projection_with_regions<'tcx>(
12681268 let cause = ObligationCause :: dummy ( ) ;
12691269 match tcx
12701270 . infer_ctxt ( )
1271- . build ( )
1271+ . build ( TypingMode :: from_param_env ( param_env ) )
12721272 . at ( & cause, param_env)
12731273 . query_normalize ( Ty :: new_projection_from_args ( tcx, ty. def_id , ty. args ) )
12741274 {
@@ -1284,7 +1284,7 @@ pub fn make_normalized_projection_with_regions<'tcx>(
12841284
12851285pub fn normalize_with_regions < ' tcx > ( tcx : TyCtxt < ' tcx > , param_env : ParamEnv < ' tcx > , ty : Ty < ' tcx > ) -> Ty < ' tcx > {
12861286 let cause = ObligationCause :: dummy ( ) ;
1287- match tcx. infer_ctxt ( ) . build ( ) . at ( & cause, param_env) . query_normalize ( ty) {
1287+ match tcx. infer_ctxt ( ) . build ( TypingMode :: from_param_env ( param_env ) ) . at ( & cause, param_env) . query_normalize ( ty) {
12881288 Ok ( ty) => ty. value ,
12891289 Err ( _) => ty,
12901290 }
0 commit comments