about summary refs log tree commit diff
path: root/src/test/ui/debuginfo
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-03-18 00:35:19 +0000
committerbors <bors@rust-lang.org>2022-03-18 00:35:19 +0000
commitcd119057160cedea245aa2679add56723f3dc784 (patch)
tree21335c52669bb2665024cf37adf8d892925d9d31 /src/test/ui/debuginfo
parent4ca56d2b7bbe275bc6c9f3cd698c6e0719a07182 (diff)
parent4493826d07bf38cca058b4d9e75bce14ceeeaab9 (diff)
downloadrust-cd119057160cedea245aa2679add56723f3dc784.tar.gz
rust-cd119057160cedea245aa2679add56723f3dc784.zip
Auto merge of #95056 - Dylan-DPC:rollup-swtuw2n, r=Dylan-DPC
Rollup of 10 pull requests

Successful merges:

 - #91133 (Improve `unsafe` diagnostic)
 - #93222 (Make ErrorReported impossible to construct outside `rustc_errors`)
 - #93745 (Stabilize ADX target feature)
 - #94309 ([generator_interior] Be more precise with scopes of borrowed places)
 - #94698 (Remove redundant code from copy-suggestions)
 - #94731 (Suggest adding `{ .. }` around a const function call with arguments)
 - #94960 (Fix many spelling mistakes)
 - #94982 (Add deprecated_safe feature gate and attribute, cc #94978)
 - #94997 (debuginfo: Fix ICE when generating name for type that produces a layout error.)
 - #95000 (Fixed wrong type name in comment)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/test/ui/debuginfo')
-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
+