about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorJubilee <46493976+workingjubilee@users.noreply.github.com>2023-10-28 01:07:39 -0700
committerGitHub <noreply@github.com>2023-10-28 01:07:39 -0700
commit09fd68d9eef049f1b440ea51010d12bb5d531792 (patch)
tree72adefa8c0143f79eca17b22b6005817b5b4d2bc /tests
parent48a3865218f11a81127a817326bd50733700594e (diff)
parent2ef5897a89f9bbd9d38b9eb1222b5bedef98814b (diff)
downloadrust-09fd68d9eef049f1b440ea51010d12bb5d531792.tar.gz
rust-09fd68d9eef049f1b440ea51010d12bb5d531792.zip
Rollup merge of #117277 - RalfJung:too-big-with-padding, r=oli-obk
fix failure to detect a too-big-type after adding padding

Fixes https://github.com/rust-lang/rust/issues/117265
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/layout/too-big-with-padding.rs18
-rw-r--r--tests/ui/layout/too-big-with-padding.stderr8
2 files changed, 26 insertions, 0 deletions
diff --git a/tests/ui/layout/too-big-with-padding.rs b/tests/ui/layout/too-big-with-padding.rs
new file mode 100644
index 00000000000..cf41ac872c2
--- /dev/null
+++ b/tests/ui/layout/too-big-with-padding.rs
@@ -0,0 +1,18 @@
+// build-fail
+// compile-flags: --target i686-unknown-linux-gnu --crate-type lib
+// needs-llvm-components: x86
+#![feature(no_core, lang_items)]
+#![allow(internal_features)]
+#![no_std]
+#![no_core]
+
+// 0x7fffffff is fine, but after rounding up it becomes too big
+#[repr(C, align(2))]
+pub struct Example([u8; 0x7fffffff]);
+
+pub fn lib(_x: Example) {} //~ERROR: too big for the current architecture
+
+#[lang = "sized"]
+pub trait Sized {}
+#[lang = "copy"]
+pub trait Copy: Sized {}
diff --git a/tests/ui/layout/too-big-with-padding.stderr b/tests/ui/layout/too-big-with-padding.stderr
new file mode 100644
index 00000000000..5cc854adce0
--- /dev/null
+++ b/tests/ui/layout/too-big-with-padding.stderr
@@ -0,0 +1,8 @@
+error: values of the type `Example` are too big for the current architecture
+  --> $DIR/too-big-with-padding.rs:13:1
+   |
+LL | pub fn lib(_x: Example) {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+