let lit = match *lit {
LitKind::Str(ref s, _) => {
let s = s.as_str();
- let allocation = Allocation::from_byte_aligned_bytes(s.as_bytes(), ());
+ let allocation = Allocation::from_byte_aligned_bytes(s.as_bytes());
let allocation = tcx.intern_const_alloc(allocation);
ConstValue::Slice { data: allocation, start: 0, end: s.len() }
},
LitKind::Err(ref s) => {
let s = s.as_str();
- let allocation = Allocation::from_byte_aligned_bytes(s.as_bytes(), ());
+ let allocation = Allocation::from_byte_aligned_bytes(s.as_bytes());
let allocation = tcx.intern_const_alloc(allocation);
return Ok(tcx.mk_const(ty::Const {
val: ConstValue::Slice{ data: allocation, start: 0, end: s.len() },
}
};
- // We trust that `data` is properly truncated.
- Ok(ConstValue::Scalar(Scalar::Raw { data, size }))
+ Ok(ConstValue::Scalar(Scalar::from_uint(data, Size::from_bytes(size))))
}