use rustc::ty::layout::{Integer, IntegerExt, VariantIdx, Size};
use rustc::mir::Field;
-use rustc::mir::interpret::{ConstValue, Scalar};
+use rustc::mir::interpret::{ConstValue, Scalar, truncate};
use rustc::util::common::ErrorReported;
use syntax::attr::{SignedInt, UnsignedInt};
vec![ConstantRange(min, max, pcx.ty, RangeEnd::Included)]
}
ty::Uint(uty) => {
- // FIXME(49937): refactor these bit manipulations into interpret.
- let bits = Integer::from_attr(&cx.tcx, UnsignedInt(uty)).size().bits() as u128;
- let max = !0u128 >> (128 - bits);
+ let size = Integer::from_attr(&cx.tcx, UnsignedInt(uty)).size();
+ let max = truncate(u128::max_value(), size);
vec![ConstantRange(0, max, pcx.ty, RangeEnd::Included)]
}
_ => {