about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-02-23 08:11:50 -0800
committerMichael Goulet <michael@errs.io>2022-02-23 08:20:12 -0800
commitc73a2f8a652134bd7bf00ca61ca65bd7adb8aec7 (patch)
treec0251fe02c1dd6ec5027f2151cbad76be530994b /src/test
parentc651ba8a542c7d89b271efbf024a31091c824f4b (diff)
downloadrust-c73a2f8a652134bd7bf00ca61ca65bd7adb8aec7.tar.gz
rust-c73a2f8a652134bd7bf00ca61ca65bd7adb8aec7.zip
properly handle fat pointers to uninhabitable types
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/debuginfo/debuginfo-emit-llvm-ir-and-split-debuginfo.rs (renamed from src/test/ui/debuginfo-emit-llvm-ir-and-split-debuginfo.rs)0
-rw-r--r--src/test/ui/debuginfo/debuginfo_with_uninhabitable_field_and_unsized.rs29
2 files changed, 29 insertions, 0 deletions
diff --git a/src/test/ui/debuginfo-emit-llvm-ir-and-split-debuginfo.rs b/src/test/ui/debuginfo/debuginfo-emit-llvm-ir-and-split-debuginfo.rs
index 043011b3316..043011b3316 100644
--- a/src/test/ui/debuginfo-emit-llvm-ir-and-split-debuginfo.rs
+++ b/src/test/ui/debuginfo/debuginfo-emit-llvm-ir-and-split-debuginfo.rs
diff --git a/src/test/ui/debuginfo/debuginfo_with_uninhabitable_field_and_unsized.rs b/src/test/ui/debuginfo/debuginfo_with_uninhabitable_field_and_unsized.rs
new file mode 100644
index 00000000000..833a4726acb
--- /dev/null
+++ b/src/test/ui/debuginfo/debuginfo_with_uninhabitable_field_and_unsized.rs
@@ -0,0 +1,29 @@
+// check-pass
+// compile-flags: -Cdebuginfo=2
+// fixes issue #94149
+
+#![allow(dead_code)]
+
+pub fn main() {
+    let _ = Foo::<dyn FooTrait>::new();
+}
+
+pub struct Foo<T: FooTrait + ?Sized> {
+    base: FooBase,
+    value: T,
+}
+
+impl<T: FooTrait + ?Sized> Foo<T> {
+    pub fn new() -> Box<Foo<T>> {
+        todo!()
+    }
+}
+
+pub trait FooTrait {}
+
+pub struct FooBase {
+    cls: Bar,
+}
+
+// Bar *must* be a fieldless enum
+pub enum Bar {}