]> git.lizzy.rs Git - rust.git/commitdiff
Unify API of `Scalar` and `ScalarMaybeUndef`
authorOliver Schneider <github35764891676564198441@oli-obk.de>
Fri, 3 Aug 2018 10:40:03 +0000 (12:40 +0200)
committerOliver Schneider <github35764891676564198441@oli-obk.de>
Fri, 3 Aug 2018 10:40:03 +0000 (12:40 +0200)
src/librustc/mir/interpret/value.rs

index 71e3ac48d5bc1dcc5d4e2b5b7515df2602676208..f569f4def143f8dd6af8c2b71b4cbc27ae4a6219 100644 (file)
@@ -103,6 +103,10 @@ pub fn to_value_with_len<C: HasDataLayout>(self, len: u64, cx: C) -> Value {
         ScalarMaybeUndef::Scalar(self).to_value_with_len(len, cx)
     }
 
+    pub fn to_value_with_vtable(self, vtable: Pointer) -> Value {
+        ScalarMaybeUndef::Scalar(self).to_value_with_vtable(vtable)
+    }
+
     pub fn ptr_signed_offset<C: HasDataLayout>(self, i: i64, cx: C) -> EvalResult<'tcx, Self> {
         let layout = cx.data_layout();
         match self {
@@ -207,14 +211,14 @@ pub fn unwrap_or_err(self) -> EvalResult<'static, Scalar> {
     }
 
     pub fn to_value_with_len<C: HasDataLayout>(self, len: u64, cx: C) -> Value {
-        Value::ScalarPair(self.into(), Scalar::Bits {
+        Value::ScalarPair(self, Scalar::Bits {
             bits: len as u128,
             size: cx.data_layout().pointer_size.bytes() as u8,
         }.into())
     }
 
     pub fn to_value_with_vtable(self, vtable: Pointer) -> Value {
-        Value::ScalarPair(self.into(), Scalar::Ptr(vtable).into())
+        Value::ScalarPair(self, Scalar::Ptr(vtable).into())
     }
 
     pub fn ptr_offset<C: HasDataLayout>(self, i: Size, cx: C) -> EvalResult<'tcx, Self> {