Skip to content

Commit 47e0bb5

Browse files
committed
Clean up the binary hex lint
1 parent c0fc6a8 commit 47e0bb5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/librustc_lint/types.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use lint::{LintPass, LateLintPass};
2121
use std::cmp;
2222
use std::{i8, i16, i32, i64, u8, u16, u32, u64, f32, f64};
2323

24-
use syntax::ast;
24+
use syntax::{ast, attr};
2525
use syntax::abi::Abi;
2626
use syntax_pos::Span;
2727
use syntax::codemap;
@@ -365,12 +365,14 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits {
365365
) {
366366
let (t, actually) = match ty {
367367
ty::TyInt(t) => {
368-
let bits = int_ty_bits(t, cx.sess().target.isize_ty);
368+
let ity = attr::IntType::SignedInt(t);
369+
let bits = layout::Integer::from_attr(cx.tcx, ity).size().bits();
369370
let actually = (val << (128 - bits)) as i128 >> (128 - bits);
370371
(format!("{:?}", t), actually.to_string())
371372
}
372373
ty::TyUint(t) => {
373-
let bits = uint_ty_bits(t, cx.sess().target.usize_ty);
374+
let ity = attr::IntType::UnsignedInt(t);
375+
let bits = layout::Integer::from_attr(cx.tcx, ity).size().bits();
374376
let actually = (val << (128 - bits)) >> (128 - bits);
375377
(format!("{:?}", t), actually.to_string())
376378
}

0 commit comments

Comments
 (0)