@@ -3,9 +3,11 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
33use rustc_hir as hir;
44use rustc_hir:: def_id:: { CrateNum , DefId } ;
55use rustc_hir:: definitions:: { DefPathData , DisambiguatedDefPathData } ;
6+ use rustc_middle:: ty:: layout:: IntegerExt ;
67use rustc_middle:: ty:: print:: { Print , Printer } ;
78use rustc_middle:: ty:: subst:: { GenericArg , GenericArgKind , Subst } ;
89use rustc_middle:: ty:: { self , FloatTy , Instance , IntTy , Ty , TyCtxt , TypeFoldable , UintTy } ;
10+ use rustc_target:: abi:: Integer ;
911use rustc_target:: spec:: abi:: Abi ;
1012
1113use std:: fmt:: Write ;
@@ -553,11 +555,9 @@ impl Printer<'tcx> for SymbolMangler<'tcx> {
553555 ty:: Uint ( _) | ty:: Bool | ty:: Char => {
554556 ct. try_eval_bits ( self . tcx , ty:: ParamEnv :: reveal_all ( ) , ct. ty )
555557 }
556- ty:: Int ( _) => {
557- let param_env = ty:: ParamEnv :: reveal_all ( ) ;
558- ct. try_eval_bits ( self . tcx , param_env, ct. ty ) . and_then ( |b| {
559- let sz = self . tcx . layout_of ( param_env. and ( ct. ty ) ) . ok ( ) ?. size ;
560- let val = sz. sign_extend ( b) as i128 ;
558+ ty:: Int ( ity) => {
559+ ct. try_eval_bits ( self . tcx , ty:: ParamEnv :: reveal_all ( ) , ct. ty ) . and_then ( |b| {
560+ let val = Integer :: from_int_ty ( & self . tcx , * ity) . size ( ) . sign_extend ( b) as i128 ;
561561 if val < 0 {
562562 neg = true ;
563563 }
0 commit comments