Skip to content

Commit 09a996b

Browse files
committed
Printing values should ignore whether bits are undefined
1 parent 98e5129 commit 09a996b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/librustc/mir/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,11 +1899,11 @@ pub fn fmt_const_val<W: Write>(fmt: &mut W, const_val: &ty::Const) -> fmt::Resul
18991899
pub fn print_miri_value<W: Write>(value: Value, ty: Ty, f: &mut W) -> fmt::Result {
19001900
use ty::TypeVariants::*;
19011901
match (value, &ty.sty) {
1902-
(Value::Scalar(Scalar::Bits { bits: 0, defined: 8 }), &TyBool) => write!(f, "false"),
1903-
(Value::Scalar(Scalar::Bits { bits: 1, defined: 8 }), &TyBool) => write!(f, "true"),
1904-
(Value::Scalar(Scalar::Bits { bits, defined: 32 }), &TyFloat(ast::FloatTy::F32)) =>
1902+
(Value::Scalar(Scalar::Bits { bits: 0, .. }), &TyBool) => write!(f, "false"),
1903+
(Value::Scalar(Scalar::Bits { bits: 1, .. }), &TyBool) => write!(f, "true"),
1904+
(Value::Scalar(Scalar::Bits { bits, .. }), &TyFloat(ast::FloatTy::F32)) =>
19051905
write!(f, "{}f32", Single::from_bits(bits)),
1906-
(Value::Scalar(Scalar::Bits { bits, defined: 64 }), &TyFloat(ast::FloatTy::F64)) =>
1906+
(Value::Scalar(Scalar::Bits { bits, .. }), &TyFloat(ast::FloatTy::F64)) =>
19071907
write!(f, "{}f64", Double::from_bits(bits)),
19081908
(Value::Scalar(Scalar::Bits { bits, .. }), &TyUint(ui)) => write!(f, "{:?}{}", bits, ui),
19091909
(Value::Scalar(Scalar::Bits { bits, .. }), &TyInt(i)) => {
@@ -1914,9 +1914,9 @@ pub fn print_miri_value<W: Write>(value: Value, ty: Ty, f: &mut W) -> fmt::Resul
19141914
let amt = 128 - bit_width;
19151915
write!(f, "{:?}{}", ((bits as i128) << amt) >> amt, i)
19161916
},
1917-
(Value::Scalar(Scalar::Bits { bits, defined: 32 }), &TyChar) =>
1917+
(Value::Scalar(Scalar::Bits { bits, .. }), &TyChar) =>
19181918
write!(f, "{:?}", ::std::char::from_u32(bits as u32).unwrap()),
1919-
(Value::Scalar(Scalar::Bits { defined: 0, .. }), &TyFnDef(did, _)) =>
1919+
(Value::Scalar(Scalar::Bits { .. }), &TyFnDef(did, _)) =>
19201920
write!(f, "{}", item_path_str(did)),
19211921
(Value::ScalarPair(Scalar::Ptr(ptr), Scalar::Bits { bits: len, .. }),
19221922
&TyRef(_, &ty::TyS { sty: TyStr, .. }, _)) => {

0 commit comments

Comments
 (0)