Add support for untagged unions.
This commit is contained in:
parent
a64d30b2c1
commit
bc5bd71922
@ -557,7 +557,25 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
||||
self.assign_fields(dest, offsets, operands)?;
|
||||
}
|
||||
|
||||
_ => return Err(EvalError::Unimplemented(format!("can't handle destination layout {:?} when assigning {:?}", dest_layout, kind))),
|
||||
UntaggedUnion { .. } => {
|
||||
assert_eq!(operands.len(), 1);
|
||||
let operand = &operands[0];
|
||||
let value = self.eval_operand(operand)?;
|
||||
let value_ty = self.operand_ty(operand);
|
||||
|
||||
// FIXME(solson)
|
||||
let dest = self.force_allocation(dest)?;
|
||||
|
||||
self.write_value(value, dest, value_ty)?;
|
||||
}
|
||||
|
||||
_ => {
|
||||
return Err(EvalError::Unimplemented(format!(
|
||||
"can't handle destination layout {:?} when assigning {:?}",
|
||||
dest_layout,
|
||||
kind
|
||||
)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -209,6 +209,8 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
||||
nonnull.offsets[field]
|
||||
}
|
||||
|
||||
UntaggedUnion { .. } => return Ok(base),
|
||||
|
||||
_ => bug!("field access on non-product type: {:?}", base_layout),
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user