@@ -19,7 +19,7 @@ use rustc_middle::ty::layout::ValidityRequirement;
19
19
use rustc_middle:: ty:: {
20
20
self , AdtDef , AliasTy , AssocItem , AssocKind , Binder , BoundRegion , FnSig , GenericArg , GenericArgKind ,
21
21
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 ,
23
23
} ;
24
24
use rustc_span:: symbol:: Ident ;
25
25
use rustc_span:: { DUMMY_SP , Span , Symbol , sym} ;
@@ -268,7 +268,7 @@ pub fn implements_trait_with_env_from_iter<'tcx>(
268
268
return false ;
269
269
}
270
270
271
- let infcx = tcx. infer_ctxt ( ) . build ( ) ;
271
+ let infcx = tcx. infer_ctxt ( ) . build ( TypingMode :: from_param_env ( param_env ) ) ;
272
272
let args = args
273
273
. into_iter ( )
274
274
. map ( |arg| arg. into ( ) . unwrap_or_else ( || infcx. next_ty_var ( DUMMY_SP ) . into ( ) ) )
@@ -362,7 +362,7 @@ fn is_normalizable_helper<'tcx>(
362
362
}
363
363
// prevent recursive loops, false-negative is better than endless loop leading to stack overflow
364
364
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 ) ) ;
366
366
let cause = ObligationCause :: dummy ( ) ;
367
367
let result = if infcx. at ( & cause, param_env) . query_normalize ( ty) . is_ok ( ) {
368
368
match ty. kind ( ) {
@@ -1268,7 +1268,7 @@ pub fn make_normalized_projection_with_regions<'tcx>(
1268
1268
let cause = ObligationCause :: dummy ( ) ;
1269
1269
match tcx
1270
1270
. infer_ctxt ( )
1271
- . build ( )
1271
+ . build ( TypingMode :: from_param_env ( param_env ) )
1272
1272
. at ( & cause, param_env)
1273
1273
. query_normalize ( Ty :: new_projection_from_args ( tcx, ty. def_id , ty. args ) )
1274
1274
{
@@ -1284,7 +1284,7 @@ pub fn make_normalized_projection_with_regions<'tcx>(
1284
1284
1285
1285
pub fn normalize_with_regions < ' tcx > ( tcx : TyCtxt < ' tcx > , param_env : ParamEnv < ' tcx > , ty : Ty < ' tcx > ) -> Ty < ' tcx > {
1286
1286
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) {
1288
1288
Ok ( ty) => ty. value ,
1289
1289
Err ( _) => ty,
1290
1290
}
0 commit comments