Skip to content

Commit 34b7566

Browse files
committed
Type can be unsized and uninhabited
1 parent e90c5fb commit 34b7566

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

compiler/rustc_middle/src/ty/layout.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
512512
}
513513
}
514514

515-
if sized && fields.iter().any(|f| f.abi.is_uninhabited()) {
515+
if fields.iter().any(|f| f.abi.is_uninhabited()) {
516516
abi = Abi::Uninhabited;
517517
}
518518

src/test/ui/issues/issue-88150.rs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// run-pass
2+
// compile-flags:-C debuginfo=2
3+
// edition:2018
4+
5+
use core::marker::PhantomData;
6+
7+
pub struct Foo<T: ?Sized, A>(
8+
PhantomData<(A, T)>,
9+
);
10+
11+
enum Never {}
12+
13+
impl<T: ?Sized> Foo<T, Never> {
14+
fn new_foo() -> Foo<T, Never> {
15+
Foo(PhantomData)
16+
}
17+
}
18+
19+
fn main() {
20+
let _ = Foo::<[()], Never>::new_foo();
21+
}

0 commit comments

Comments
 (0)