Skip to content

Commit 4ce3749

Browse files
committedFeb 28, 2022
Auto merge of #94453 - matthiaskrgr:rollup-xv9y98j, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #92399 (fix typo in btree/vec doc: Self -> self) - #92823 (Tweak diagnostics) - #94248 (Fix ICE when passing block to while-loop condition) - #94414 (Fix ICE when using Box<T, A> with large A) - #94445 (4 - Make more use of `let_chains`) - #94449 (Add long explanation for E0726) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 97cde9f + 34657cc commit 4ce3749

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+591
-321
lines changed
 

‎compiler/rustc_codegen_ssa/src/mir/place.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,18 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
453453
};
454454
for elem in place_ref.projection[base..].iter() {
455455
cg_base = match elem.clone() {
456-
mir::ProjectionElem::Deref => bx.load_operand(cg_base).deref(bx.cx()),
456+
mir::ProjectionElem::Deref => {
457+
// custom allocators can change box's abi, making it unable to be derefed directly
458+
if cg_base.layout.ty.is_box()
459+
&& matches!(cg_base.layout.abi, Abi::Aggregate { .. } | Abi::Uninhabited)
460+
{
461+
let ptr = cg_base.project_field(bx, 0).project_field(bx, 0);
462+
463+
bx.load_operand(ptr).deref(bx.cx())
464+
} else {
465+
bx.load_operand(cg_base).deref(bx.cx())
466+
}
467+
}
457468
mir::ProjectionElem::Field(ref field, _) => {
458469
cg_base.project_field(bx, field.index())
459470
}

‎compiler/rustc_error_codes/src/error_codes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ E0720: include_str!("./error_codes/E0720.md"),
429429
E0722: include_str!("./error_codes/E0722.md"),
430430
E0724: include_str!("./error_codes/E0724.md"),
431431
E0725: include_str!("./error_codes/E0725.md"),
432+
E0726: include_str!("./error_codes/E0726.md"),
432433
E0727: include_str!("./error_codes/E0727.md"),
433434
E0728: include_str!("./error_codes/E0728.md"),
434435
E0729: include_str!("./error_codes/E0729.md"),
@@ -641,6 +642,5 @@ E0787: include_str!("./error_codes/E0787.md"),
641642
E0717, // rustc_promotable without stability attribute
642643
// E0721, // `await` keyword
643644
// E0723, // unstable feature in `const` context
644-
E0726, // non-explicit (not `'_`) elided lifetime in unsupported position
645645
// E0738, // Removed; errored on `#[track_caller] fn`s in `extern "Rust" { ... }`.
646646
}

0 commit comments

Comments
 (0)
Please sign in to comment.