From c73a2f8a652134bd7bf00ca61ca65bd7adb8aec7 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Wed, 23 Feb 2022 08:11:50 -0800 Subject: properly handle fat pointers to uninhabitable types --- .../debuginfo-emit-llvm-ir-and-split-debuginfo.rs | 7 ++++++ ...buginfo_with_uninhabitable_field_and_unsized.rs | 29 ++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 src/test/ui/debuginfo/debuginfo-emit-llvm-ir-and-split-debuginfo.rs create mode 100644 src/test/ui/debuginfo/debuginfo_with_uninhabitable_field_and_unsized.rs (limited to 'src/test/ui/debuginfo') diff --git a/src/test/ui/debuginfo/debuginfo-emit-llvm-ir-and-split-debuginfo.rs b/src/test/ui/debuginfo/debuginfo-emit-llvm-ir-and-split-debuginfo.rs new file mode 100644 index 00000000000..043011b3316 --- /dev/null +++ b/src/test/ui/debuginfo/debuginfo-emit-llvm-ir-and-split-debuginfo.rs @@ -0,0 +1,7 @@ +// build-pass +// +// compile-flags: -g --emit=llvm-ir -Zunstable-options -Csplit-debuginfo=unpacked +// +// Make sure that we don't explode with an error if we don't actually end up emitting any `dwo`s, +// as would be the case if we don't actually codegen anything. +#![crate_type="rlib"] 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::::new(); +} + +pub struct Foo { + base: FooBase, + value: T, +} + +impl Foo { + pub fn new() -> Box> { + todo!() + } +} + +pub trait FooTrait {} + +pub struct FooBase { + cls: Bar, +} + +// Bar *must* be a fieldless enum +pub enum Bar {} -- cgit 1.4.1-3-g733a5