mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 18:23:49 +00:00
Unify API of Scalar
and ScalarMaybeUndef
This commit is contained in:
parent
4819094031
commit
828aebfe3a
@ -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> {
|
||||
|
Loading…
Reference in New Issue
Block a user