properly handle fat pointers to uninhabitable types
This commit is contained in:
parent
c651ba8a54
commit
c73a2f8a65
4 changed files with 49 additions and 18 deletions
|
|
@ -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 {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue