Skip to content

Commit 34fd8d6

Browse files
authored
Rollup merge of rust-lang#90854 - sanxiyn:unsized-and-uninhabited, r=estebank
Type can be unsized and uninhabited Fix rust-lang#88150.
2 parents 021e18c + 34b7566 commit 34fd8d6

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

compiler/rustc_middle/src/ty/layout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
533533
}
534534
}
535535

536-
if sized && fields.iter().any(|f| f.abi.is_uninhabited()) {
536+
if fields.iter().any(|f| f.abi.is_uninhabited()) {
537537
abi = Abi::Uninhabited;
538538
}
539539

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

Lines changed: 21 additions & 0 deletions
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)