diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs index b87e23af72b..a8dec82c883 100644 --- a/compiler/rustc_middle/src/ty/layout.rs +++ b/compiler/rustc_middle/src/ty/layout.rs @@ -512,7 +512,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> { } } - if sized && fields.iter().any(|f| f.abi.is_uninhabited()) { + if fields.iter().any(|f| f.abi.is_uninhabited()) { abi = Abi::Uninhabited; } diff --git a/src/test/ui/issues/issue-88150.rs b/src/test/ui/issues/issue-88150.rs new file mode 100644 index 00000000000..555a38637a4 --- /dev/null +++ b/src/test/ui/issues/issue-88150.rs @@ -0,0 +1,21 @@ +// run-pass +// compile-flags:-C debuginfo=2 +// edition:2018 + +use core::marker::PhantomData; + +pub struct Foo( + PhantomData<(A, T)>, +); + +enum Never {} + +impl Foo { + fn new_foo() -> Foo { + Foo(PhantomData) + } +} + +fn main() { + let _ = Foo::<[()], Never>::new_foo(); +}