about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDrMeepster <19316085+DrMeepster@users.noreply.github.com>2022-02-27 20:25:16 -0800
committerDrMeepster <19316085+DrMeepster@users.noreply.github.com>2022-02-27 20:25:16 -0800
commitd316aba04c4644093ba07d1ec8d334b599b8eb01 (patch)
tree3acd7847991294b300a1057a8ad034b06bf0a014
parentbfa7d44823717c30bc21abc1ca3675d0b78c80a2 (diff)
downloadrust-d316aba04c4644093ba07d1ec8d334b599b8eb01.tar.gz
rust-d316aba04c4644093ba07d1ec8d334b599b8eb01.zip
expadn abi check + condese & fix tests
-rw-r--r--compiler/rustc_codegen_ssa/src/mir/place.rs2
-rw-r--r--src/test/ui/box/issue-78459-ice.rs6
-rw-r--r--src/test/ui/box/large-allocator-ice.rs (renamed from src/test/ui/box/issue-81270-ice.rs)3
3 files changed, 3 insertions, 8 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/place.rs b/compiler/rustc_codegen_ssa/src/mir/place.rs
index aee385ab050..809d6447908 100644
--- a/compiler/rustc_codegen_ssa/src/mir/place.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/place.rs
@@ -456,7 +456,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
                 mir::ProjectionElem::Deref => {
                     // custom allocators can change box's abi, making it unable to be derefed directly
                     if cg_base.layout.ty.is_box()
-                        && matches!(cg_base.layout.abi, Abi::Aggregate { .. })
+                        && matches!(cg_base.layout.abi, Abi::Aggregate { .. } | Abi::Uninhabited)
                     {
                         let ptr = cg_base.project_field(bx, 0).project_field(bx, 0);
 
diff --git a/src/test/ui/box/issue-78459-ice.rs b/src/test/ui/box/issue-78459-ice.rs
deleted file mode 100644
index 89f75fea15b..00000000000
--- a/src/test/ui/box/issue-78459-ice.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-// check-pass
-#![feature(allocator_api)]
-
-fn main() {
-    Box::new_in((), &std::alloc::Global);
-}
diff --git a/src/test/ui/box/issue-81270-ice.rs b/src/test/ui/box/large-allocator-ice.rs
index fb42aed7aae..3ef1171ff50 100644
--- a/src/test/ui/box/issue-81270-ice.rs
+++ b/src/test/ui/box/large-allocator-ice.rs
@@ -1,4 +1,4 @@
-// check-pass
+// build-pass
 #![feature(allocator_api)]
 
 use std::alloc::Allocator;
@@ -18,5 +18,6 @@ unsafe impl Allocator for BigAllocator {
 }
 
 fn main() {
+    Box::new_in((), &std::alloc::Global);
     Box::new_in((), BigAllocator([0; 2]));
 }