mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +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() {
|
cg_base = match elem.clone() {
|
||||||
mir::ProjectionElem::Deref => {
|
mir::ProjectionElem::Deref => {
|
||||||
// a box with a non-zst allocator should not be directly dereferenced
|
// 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);
|
let ptr = cg_base.project_field(bx, 0).project_field(bx, 0);
|
||||||
|
|
||||||
bx.load_operand(ptr).deref(bx.cx())
|
bx.load_operand(ptr).deref(bx.cx())
|
||||||
|
Loading…
Reference in New Issue
Block a user