about summary refs log tree commit diff
path: root/src/test/ui
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-03-17 22:55:07 +0100
committerGitHub <noreply@github.com>2022-03-17 22:55:07 +0100
commite55400ca27a9fec35e8ae6e23d92a02305c4c4be (patch)
tree6df55e96811fdd3fe53214d8f293e59ddf7c8a21 /src/test/ui
parent0c73b252eb024c2c9b16e2a03e0e2756e14b62bf (diff)
parent243e2a698c0c6573dc5445b07e0dcb6b0167f876 (diff)
downloadrust-e55400ca27a9fec35e8ae6e23d92a02305c4c4be.tar.gz
rust-e55400ca27a9fec35e8ae6e23d92a02305c4c4be.zip
Rollup merge of #94997 - michaelwoerister:fix-enum-type-name-layout-error, r=wesleywiser
debuginfo: Fix ICE when generating name for type that produces a layout error.

Fixes https://github.com/rust-lang/rust/issues/94961.
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/debuginfo/debuginfo-type-name-layout-ice-94961-1.rs16
-rw-r--r--src/test/ui/debuginfo/debuginfo-type-name-layout-ice-94961-1.stderr4
-rw-r--r--src/test/ui/debuginfo/debuginfo-type-name-layout-ice-94961-2.rs20
-rw-r--r--src/test/ui/debuginfo/debuginfo-type-name-layout-ice-94961-2.stderr4
4 files changed, 44 insertions, 0 deletions
diff --git a/src/test/ui/debuginfo/debuginfo-type-name-layout-ice-94961-1.rs b/src/test/ui/debuginfo/debuginfo-type-name-layout-ice-94961-1.rs
new file mode 100644
index 00000000000..78bda28485d
--- /dev/null
+++ b/src/test/ui/debuginfo/debuginfo-type-name-layout-ice-94961-1.rs
@@ -0,0 +1,16 @@
+// Make sure the compiler does not ICE when trying to generate the debuginfo name of a type that
+// causes a layout error. See https://github.com/rust-lang/rust/issues/94961.
+
+// compile-flags:-C debuginfo=2
+// build-fail
+// error-pattern: too big for the current architecture
+// normalize-stderr-64bit "18446744073709551615" -> "SIZE"
+// normalize-stderr-32bit "4294967295" -> "SIZE"
+
+#![crate_type = "rlib"]
+
+pub struct Foo<T>([T; usize::MAX]);
+
+pub fn foo() -> usize {
+    std::mem::size_of::<Foo<u8>>()
+}
diff --git a/src/test/ui/debuginfo/debuginfo-type-name-layout-ice-94961-1.stderr b/src/test/ui/debuginfo/debuginfo-type-name-layout-ice-94961-1.stderr
new file mode 100644
index 00000000000..851dca84c3d
--- /dev/null
+++ b/src/test/ui/debuginfo/debuginfo-type-name-layout-ice-94961-1.stderr
@@ -0,0 +1,4 @@
+error: values of the type `[u8; SIZE]` are too big for the current architecture
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/debuginfo/debuginfo-type-name-layout-ice-94961-2.rs b/src/test/ui/debuginfo/debuginfo-type-name-layout-ice-94961-2.rs
new file mode 100644
index 00000000000..fdc088dc0f9
--- /dev/null
+++ b/src/test/ui/debuginfo/debuginfo-type-name-layout-ice-94961-2.rs
@@ -0,0 +1,20 @@
+// Make sure the compiler does not ICE when trying to generate the debuginfo name of a type that
+// causes a layout error.
+// This version of the test already ICE'd before the commit that introduce the ICE described in
+// https://github.com/rust-lang/rust/issues/94961.
+
+// compile-flags:-C debuginfo=2
+// build-fail
+// error-pattern: too big for the current architecture
+// normalize-stderr-64bit "18446744073709551615" -> "SIZE"
+// normalize-stderr-32bit "4294967295" -> "SIZE"
+
+#![crate_type = "rlib"]
+
+pub enum Foo<T> {
+    Bar([T; usize::MAX]),
+}
+
+pub fn foo() -> usize {
+    std::mem::size_of::<Foo<u8>>()
+}
diff --git a/src/test/ui/debuginfo/debuginfo-type-name-layout-ice-94961-2.stderr b/src/test/ui/debuginfo/debuginfo-type-name-layout-ice-94961-2.stderr
new file mode 100644
index 00000000000..851dca84c3d
--- /dev/null
+++ b/src/test/ui/debuginfo/debuginfo-type-name-layout-ice-94961-2.stderr
@@ -0,0 +1,4 @@
+error: values of the type `[u8; SIZE]` are too big for the current architecture
+
+error: aborting due to previous error
+