@@ -20,9 +20,7 @@ use rustc_hir::definitions::{DefPathData, DefPathDataName, DisambiguatedDefPathD
2020use rustc_hir:: { CoroutineDesugaring , CoroutineKind , CoroutineSource , Mutability } ;
2121use rustc_middle:: bug;
2222use rustc_middle:: ty:: layout:: { IntegerExt , TyAndLayout } ;
23- use rustc_middle:: ty:: {
24- self , ExistentialProjection , GenericArgKind , GenericArgsRef , ParamEnv , Ty , TyCtxt ,
25- } ;
23+ use rustc_middle:: ty:: { self , ExistentialProjection , GenericArgKind , GenericArgsRef , Ty , TyCtxt } ;
2624use rustc_target:: abi:: Integer ;
2725use smallvec:: SmallVec ;
2826
@@ -82,7 +80,7 @@ fn push_debuginfo_type_name<'tcx>(
8280 ty:: Adt ( def, args) => {
8381 // `layout_for_cpp_like_fallback` will be `Some` if we want to use the fallback encoding.
8482 let layout_for_cpp_like_fallback = if cpp_like_debuginfo && def. is_enum ( ) {
85- match tcx. layout_of ( ParamEnv :: reveal_all ( ) . and ( t) ) {
83+ match tcx. layout_of ( ty :: TypingEnv :: fully_monomorphized ( ) . as_query_input ( t) ) {
8684 Ok ( layout) => {
8785 if !wants_c_like_enum_debuginfo ( tcx, layout) {
8886 Some ( layout)
@@ -248,8 +246,10 @@ fn push_debuginfo_type_name<'tcx>(
248246 } ;
249247
250248 if let Some ( principal) = trait_data. principal ( ) {
251- let principal =
252- tcx. normalize_erasing_late_bound_regions ( ty:: ParamEnv :: reveal_all ( ) , principal) ;
249+ let principal = tcx. normalize_erasing_late_bound_regions (
250+ ty:: TypingEnv :: fully_monomorphized ( ) ,
251+ principal,
252+ ) ;
253253 push_item_name ( tcx, principal. def_id , qualified, output) ;
254254 let principal_has_generic_params =
255255 push_generic_params_internal ( tcx, principal. args , output, visited) ;
@@ -350,8 +350,10 @@ fn push_debuginfo_type_name<'tcx>(
350350 return ;
351351 }
352352
353- let sig =
354- tcx. normalize_erasing_late_bound_regions ( ty:: ParamEnv :: reveal_all ( ) , t. fn_sig ( tcx) ) ;
353+ let sig = tcx. normalize_erasing_late_bound_regions (
354+ ty:: TypingEnv :: fully_monomorphized ( ) ,
355+ t. fn_sig ( tcx) ,
356+ ) ;
355357
356358 if cpp_like_debuginfo {
357359 // Format as a C++ function pointer: return_type (*)(params...)
@@ -415,7 +417,8 @@ fn push_debuginfo_type_name<'tcx>(
415417 // In the case of cpp-like debuginfo, the name additionally gets wrapped inside of
416418 // an artificial `enum2$<>` type, as defined in msvc_enum_fallback().
417419 if cpp_like_debuginfo && t. is_coroutine ( ) {
418- let ty_and_layout = tcx. layout_of ( ParamEnv :: reveal_all ( ) . and ( t) ) . unwrap ( ) ;
420+ let ty_and_layout =
421+ tcx. layout_of ( ty:: TypingEnv :: fully_monomorphized ( ) . as_query_input ( t) ) . unwrap ( ) ;
419422 msvc_enum_fallback (
420423 tcx,
421424 ty_and_layout,
@@ -529,8 +532,8 @@ pub fn compute_debuginfo_vtable_name<'tcx>(
529532 }
530533
531534 if let Some ( trait_ref) = trait_ref {
532- let trait_ref =
533- tcx . normalize_erasing_late_bound_regions ( ty:: ParamEnv :: reveal_all ( ) , trait_ref) ;
535+ let trait_ref = tcx
536+ . normalize_erasing_late_bound_regions ( ty:: TypingEnv :: fully_monomorphized ( ) , trait_ref) ;
534537 push_item_name ( tcx, trait_ref. def_id , true , & mut vtable_name) ;
535538 visited. clear ( ) ;
536539 push_generic_params_internal ( tcx, trait_ref. args , & mut vtable_name, & mut visited) ;
@@ -639,7 +642,7 @@ fn push_generic_params_internal<'tcx>(
639642 output : & mut String ,
640643 visited : & mut FxHashSet < Ty < ' tcx > > ,
641644) -> bool {
642- assert_eq ! ( args, tcx. normalize_erasing_regions( ty:: ParamEnv :: reveal_all ( ) , args) ) ;
645+ assert_eq ! ( args, tcx. normalize_erasing_regions( ty:: TypingEnv :: fully_monomorphized ( ) , args) ) ;
643646 let mut args = args. non_erasable_generics ( ) . peekable ( ) ;
644647 if args. peek ( ) . is_none ( ) {
645648 return false ;
@@ -678,14 +681,14 @@ fn push_const_param<'tcx>(tcx: TyCtxt<'tcx>, ct: ty::Const<'tcx>, output: &mut S
678681 // FIXME: directly extract the bits from a valtree instead of evaluating an
679682 // already evaluated `Const` in order to get the bits.
680683 let bits = ct
681- . try_to_bits ( tcx, ty:: ParamEnv :: reveal_all ( ) )
684+ . try_to_bits ( tcx, ty:: TypingEnv :: fully_monomorphized ( ) )
682685 . expect ( "expected monomorphic const in codegen" ) ;
683686 let val = Integer :: from_int_ty ( & tcx, * ity) . size ( ) . sign_extend ( bits) as i128 ;
684687 write ! ( output, "{val}" )
685688 }
686689 ty:: Uint ( _) => {
687690 let val = ct
688- . try_to_bits ( tcx, ty:: ParamEnv :: reveal_all ( ) )
691+ . try_to_bits ( tcx, ty:: TypingEnv :: fully_monomorphized ( ) )
689692 . expect ( "expected monomorphic const in codegen" ) ;
690693 write ! ( output, "{val}" )
691694 }
0 commit comments