about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Schneider <github35764891676564198441@oli-obk.de>2018-08-03 12:40:03 +0200
committerOliver Schneider <github35764891676564198441@oli-obk.de>2018-08-03 12:40:03 +0200
commit828aebfe3a2a4beef1dd149f61ce26057d52ce70 (patch)
treec0a1df5ff2a67f5d1a7019b30a83b77d3353874e
parent481909403167d88ecc61ebe16d7065ea002bae84 (diff)
downloadrust-828aebfe3a2a4beef1dd149f61ce26057d52ce70.tar.gz
rust-828aebfe3a2a4beef1dd149f61ce26057d52ce70.zip
Unify API of `Scalar` and `ScalarMaybeUndef`
-rw-r--r--src/librustc/mir/interpret/value.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/librustc/mir/interpret/value.rs b/src/librustc/mir/interpret/value.rs
index 71e3ac48d5b..f569f4def14 100644
--- a/src/librustc/mir/interpret/value.rs
+++ b/src/librustc/mir/interpret/value.rs
@@ -103,6 +103,10 @@ impl<'tcx> Scalar {
         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 @@ impl ScalarMaybeUndef {
     }
 
     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> {