]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #4153 - matthiaskrgr:rustup_5, r=flip1995
authorbors <bors@rust-lang.org>
Wed, 29 May 2019 20:01:57 +0000 (20:01 +0000)
committerbors <bors@rust-lang.org>
Wed, 29 May 2019 20:01:57 +0000 (20:01 +0000)
rustup https://github.com/rust-lang/rust/pull/60928

changelog: none

clippy_lints/src/consts.rs

index ef415f453305bfe47d03313a5a4af1ad44fc37ec..c6831eb928bf6d736fdaae59b48eb6729459dadd 100644 (file)
@@ -472,18 +472,18 @@ fn binop(&mut self, op: BinOp, left: &Expr, right: &Expr) -> Option<Constant> {
 pub fn miri_to_const(result: &ty::Const<'_>) -> Option<Constant> {
     use rustc::mir::interpret::{ConstValue, Scalar};
     match result.val {
-        ConstValue::Scalar(Scalar::Bits { bits: b, .. }) => match result.ty.sty {
-            ty::Bool => Some(Constant::Bool(b == 1)),
-            ty::Uint(_) | ty::Int(_) => Some(Constant::Int(b)),
+        ConstValue::Scalar(Scalar::Raw { data: d, .. }) => match result.ty.sty {
+            ty::Bool => Some(Constant::Bool(d == 1)),
+            ty::Uint(_) | ty::Int(_) => Some(Constant::Int(d)),
             ty::Float(FloatTy::F32) => Some(Constant::F32(f32::from_bits(
-                b.try_into().expect("invalid f32 bit representation"),
+                d.try_into().expect("invalid f32 bit representation"),
             ))),
             ty::Float(FloatTy::F64) => Some(Constant::F64(f64::from_bits(
-                b.try_into().expect("invalid f64 bit representation"),
+                d.try_into().expect("invalid f64 bit representation"),
             ))),
             ty::RawPtr(type_and_mut) => {
                 if let ty::Uint(_) = type_and_mut.ty.sty {
-                    return Some(Constant::RawPtr(b));
+                    return Some(Constant::RawPtr(d));
                 }
                 None
             },