mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
check the the right field
This commit is contained in:
parent
e9f08e709d
commit
ece64ed3f5
@ -455,7 +455,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
cg_base = match elem.clone() {
|
||||
mir::ProjectionElem::Deref => {
|
||||
// a box with a non-zst allocator should not be directly dereferenced
|
||||
if cg_base.layout.ty.is_box() && !cg_base.layout.field(cx, 0).is_zst() {
|
||||
if cg_base.layout.ty.is_box() && !cg_base.layout.field(cx, 1).is_zst() {
|
||||
let ptr = cg_base.project_field(bx, 0).project_field(bx, 0);
|
||||
|
||||
bx.load_operand(ptr).deref(bx.cx())
|
||||
|
Loading…
Reference in New Issue
Block a user