@@ -3,9 +3,11 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
3
3
use rustc_hir as hir;
4
4
use rustc_hir:: def_id:: { CrateNum , DefId } ;
5
5
use rustc_hir:: definitions:: { DefPathData , DisambiguatedDefPathData } ;
6
+ use rustc_middle:: ty:: layout:: IntegerExt ;
6
7
use rustc_middle:: ty:: print:: { Print , Printer } ;
7
8
use rustc_middle:: ty:: subst:: { GenericArg , GenericArgKind , Subst } ;
8
9
use rustc_middle:: ty:: { self , FloatTy , Instance , IntTy , Ty , TyCtxt , TypeFoldable , UintTy } ;
10
+ use rustc_target:: abi:: Integer ;
9
11
use rustc_target:: spec:: abi:: Abi ;
10
12
11
13
use std:: fmt:: Write ;
@@ -553,11 +555,9 @@ impl Printer<'tcx> for SymbolMangler<'tcx> {
553
555
ty:: Uint ( _) | ty:: Bool | ty:: Char => {
554
556
ct. try_eval_bits ( self . tcx , ty:: ParamEnv :: reveal_all ( ) , ct. ty )
555
557
}
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 ;
561
561
if val < 0 {
562
562
neg = true ;
563
563
}
0 commit comments