@@ -20,9 +20,7 @@ use rustc_hir::definitions::{DefPathData, DefPathDataName, DisambiguatedDefPathD
20
20
use rustc_hir:: { CoroutineDesugaring , CoroutineKind , CoroutineSource , Mutability } ;
21
21
use rustc_middle:: bug;
22
22
use 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 } ;
26
24
use rustc_target:: abi:: Integer ;
27
25
use smallvec:: SmallVec ;
28
26
@@ -82,7 +80,7 @@ fn push_debuginfo_type_name<'tcx>(
82
80
ty:: Adt ( def, args) => {
83
81
// `layout_for_cpp_like_fallback` will be `Some` if we want to use the fallback encoding.
84
82
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) ) {
86
84
Ok ( layout) => {
87
85
if !wants_c_like_enum_debuginfo ( tcx, layout) {
88
86
Some ( layout)
@@ -248,8 +246,10 @@ fn push_debuginfo_type_name<'tcx>(
248
246
} ;
249
247
250
248
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
+ ) ;
253
253
push_item_name ( tcx, principal. def_id , qualified, output) ;
254
254
let principal_has_generic_params =
255
255
push_generic_params_internal ( tcx, principal. args , output, visited) ;
@@ -350,8 +350,10 @@ fn push_debuginfo_type_name<'tcx>(
350
350
return ;
351
351
}
352
352
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
+ ) ;
355
357
356
358
if cpp_like_debuginfo {
357
359
// Format as a C++ function pointer: return_type (*)(params...)
@@ -415,7 +417,8 @@ fn push_debuginfo_type_name<'tcx>(
415
417
// In the case of cpp-like debuginfo, the name additionally gets wrapped inside of
416
418
// an artificial `enum2$<>` type, as defined in msvc_enum_fallback().
417
419
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 ( ) ;
419
422
msvc_enum_fallback (
420
423
tcx,
421
424
ty_and_layout,
@@ -529,8 +532,8 @@ pub fn compute_debuginfo_vtable_name<'tcx>(
529
532
}
530
533
531
534
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) ;
534
537
push_item_name ( tcx, trait_ref. def_id , true , & mut vtable_name) ;
535
538
visited. clear ( ) ;
536
539
push_generic_params_internal ( tcx, trait_ref. args , & mut vtable_name, & mut visited) ;
@@ -639,7 +642,7 @@ fn push_generic_params_internal<'tcx>(
639
642
output : & mut String ,
640
643
visited : & mut FxHashSet < Ty < ' tcx > > ,
641
644
) -> 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) ) ;
643
646
let mut args = args. non_erasable_generics ( ) . peekable ( ) ;
644
647
if args. peek ( ) . is_none ( ) {
645
648
return false ;
@@ -678,14 +681,14 @@ fn push_const_param<'tcx>(tcx: TyCtxt<'tcx>, ct: ty::Const<'tcx>, output: &mut S
678
681
// FIXME: directly extract the bits from a valtree instead of evaluating an
679
682
// already evaluated `Const` in order to get the bits.
680
683
let bits = ct
681
- . try_to_bits ( tcx, ty:: ParamEnv :: reveal_all ( ) )
684
+ . try_to_bits ( tcx, ty:: TypingEnv :: fully_monomorphized ( ) )
682
685
. expect ( "expected monomorphic const in codegen" ) ;
683
686
let val = Integer :: from_int_ty ( & tcx, * ity) . size ( ) . sign_extend ( bits) as i128 ;
684
687
write ! ( output, "{val}" )
685
688
}
686
689
ty:: Uint ( _) => {
687
690
let val = ct
688
- . try_to_bits ( tcx, ty:: ParamEnv :: reveal_all ( ) )
691
+ . try_to_bits ( tcx, ty:: TypingEnv :: fully_monomorphized ( ) )
689
692
. expect ( "expected monomorphic const in codegen" ) ;
690
693
write ! ( output, "{val}" )
691
694
}
0 commit comments