diff options
| author | Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2018-03-07 08:17:03 +0100 | 
|---|---|---|
| committer | Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2018-03-08 08:35:39 +0100 | 
| commit | 47e0bb59dbfe1010ed19bfd49c21fa7da4ab4f42 (patch) | |
| tree | 66252210ae3764923b8254ee29151ca23fe2b193 /src | |
| parent | c0fc6a8b6b5bba6eed003fdc08e3af1967ab349d (diff) | |
| download | rust-47e0bb59dbfe1010ed19bfd49c21fa7da4ab4f42.tar.gz rust-47e0bb59dbfe1010ed19bfd49c21fa7da4ab4f42.zip | |
Clean up the binary hex lint
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_lint/types.rs | 8 | 
1 files changed, 5 insertions, 3 deletions
| diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index be7f1152ea4..266f322e397 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -21,7 +21,7 @@ use lint::{LintPass, LateLintPass}; use std::cmp; use std::{i8, i16, i32, i64, u8, u16, u32, u64, f32, f64}; -use syntax::ast; +use syntax::{ast, attr}; use syntax::abi::Abi; use syntax_pos::Span; use syntax::codemap; @@ -365,12 +365,14 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits { ) { let (t, actually) = match ty { ty::TyInt(t) => { - let bits = int_ty_bits(t, cx.sess().target.isize_ty); + let ity = attr::IntType::SignedInt(t); + let bits = layout::Integer::from_attr(cx.tcx, ity).size().bits(); let actually = (val << (128 - bits)) as i128 >> (128 - bits); (format!("{:?}", t), actually.to_string()) } ty::TyUint(t) => { - let bits = uint_ty_bits(t, cx.sess().target.usize_ty); + let ity = attr::IntType::UnsignedInt(t); + let bits = layout::Integer::from_attr(cx.tcx, ity).size().bits(); let actually = (val << (128 - bits)) >> (128 - bits); (format!("{:?}", t), actually.to_string()) } | 
