mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-04 19:29:07 +00:00
Simplify a ScalarPair creation
This commit is contained in:
parent
ca8c27e1c1
commit
1a2964a541
@ -1134,13 +1134,8 @@ fn lit_to_const<'a, 'tcx>(lit: &'tcx ast::LitKind,
|
|||||||
LitKind::Str(ref s, _) => {
|
LitKind::Str(ref s, _) => {
|
||||||
let s = s.as_str();
|
let s = s.as_str();
|
||||||
let id = tcx.allocate_bytes(s.as_bytes());
|
let id = tcx.allocate_bytes(s.as_bytes());
|
||||||
ConstValue::ScalarPair(
|
let value = Scalar::Ptr(id.into()).to_value_with_len(s.len() as u64, tcx);
|
||||||
Scalar::Ptr(id.into()),
|
ConstValue::from_byval_value(value)
|
||||||
Scalar::Bits {
|
|
||||||
bits: s.len() as u128,
|
|
||||||
defined: tcx.data_layout.pointer_size.bits() as u8,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
LitKind::ByteStr(ref data) => {
|
LitKind::ByteStr(ref data) => {
|
||||||
let id = tcx.allocate_bytes(data);
|
let id = tcx.allocate_bytes(data);
|
||||||
|
Loading…
Reference in New Issue
Block a user