don't allocate for primvals
This commit is contained in:
parent
2282e6b582
commit
e2c5a6e64e
1 changed files with 6 additions and 2 deletions
|
@ -219,8 +219,12 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
|||
(ptr, LvalueExtra::None)
|
||||
},
|
||||
Value::ByVal(PrimVal::Undef) => {
|
||||
// FIXME: add some logic for when to not allocate
|
||||
(self.force_allocation(base)?.to_ptr(), LvalueExtra::None)
|
||||
// FIXME: allocate in fewer cases
|
||||
if self.ty_to_primval_kind(base_ty).is_ok() {
|
||||
return Ok(base);
|
||||
} else {
|
||||
(self.force_allocation(base)?.to_ptr(), LvalueExtra::None)
|
||||
}
|
||||
},
|
||||
Value::ByVal(_) => {
|
||||
assert_eq!(field_index, 0, "ByVal can only have 1 non zst field with offset 0");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue