use std::vec::IntoIter;
use std::{iter, mem, option, u32};
use syntax::ast::{self, Name};
+use syntax::attr::SignedInt;
use syntax::symbol::InternedString;
use syntax_pos::{Span, DUMMY_SP};
use ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};
}
}
-pub fn print_miri_value<W: Write>(value: Value, ty: Ty, f: &mut W) -> fmt::Result {
+pub fn print_miri_value<'tcx, W: Write>(value: Value, ty: Ty<'tcx>, f: &mut W) -> fmt::Result {
use ty::TypeVariants::*;
// print some primitives
if let Value::Scalar(ScalarMaybeUndef::Scalar(Scalar::Bits { bits, .. })) = value {
ty::TyInt(_) => {
// FIXME(49937): refactor these bit manipulations into interpret.
let bits = tcx.layout_of(ty::ParamEnv::reveal_all().and(ty))
- .unwrap().size.bits() as u128;
+ .unwrap().size.bits() as u128;
let min = 1u128 << (bits - 1);
let mask = !0u128 >> (128 - bits);
if encode {
let offset = |x: u128| x.wrapping_sub(min) & mask;
(offset(lo), offset(hi))
} else {
- let offset = |x: u128| {
- // FIXME: this shouldn't be necessary once `print_miri_value`
- // sign-extends `TyInt`.
- interpret::sign_extend(tcx, x.wrapping_add(min) & mask, ty)
- .expect("layout error for TyInt")
- };
+ let offset = |x: u128| x.wrapping_add(min) & mask;
(offset(lo), offset(hi))
}
}