Skip to content

Commit 828aebf

Browse files
committed
Unify API of Scalar and ScalarMaybeUndef
1 parent 4819094 commit 828aebf

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/librustc/mir/interpret/value.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ impl<'tcx> Scalar {
103103
ScalarMaybeUndef::Scalar(self).to_value_with_len(len, cx)
104104
}
105105

106+
pub fn to_value_with_vtable(self, vtable: Pointer) -> Value {
107+
ScalarMaybeUndef::Scalar(self).to_value_with_vtable(vtable)
108+
}
109+
106110
pub fn ptr_signed_offset<C: HasDataLayout>(self, i: i64, cx: C) -> EvalResult<'tcx, Self> {
107111
let layout = cx.data_layout();
108112
match self {
@@ -207,14 +211,14 @@ impl ScalarMaybeUndef {
207211
}
208212

209213
pub fn to_value_with_len<C: HasDataLayout>(self, len: u64, cx: C) -> Value {
210-
Value::ScalarPair(self.into(), Scalar::Bits {
214+
Value::ScalarPair(self, Scalar::Bits {
211215
bits: len as u128,
212216
size: cx.data_layout().pointer_size.bytes() as u8,
213217
}.into())
214218
}
215219

216220
pub fn to_value_with_vtable(self, vtable: Pointer) -> Value {
217-
Value::ScalarPair(self.into(), Scalar::Ptr(vtable).into())
221+
Value::ScalarPair(self, Scalar::Ptr(vtable).into())
218222
}
219223

220224
pub fn ptr_offset<C: HasDataLayout>(self, i: Size, cx: C) -> EvalResult<'tcx, Self> {

0 commit comments

Comments
 (0)