forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#94242 - compiler-errors:fat-uninhabitable-p…
…ointer, r=michaelwoerister properly handle fat pointers to uninhabitable types Calculate the pointee metadata size by using `tcx.struct_tail_erasing_lifetimes` instead of duplicating the logic in `fat_pointer_kind`. Open to alternatively suggestions on how to fix this. Fixes rust-lang#94149 r? `@michaelwoerister` since you touched this code last, I think!
- Loading branch information
Showing
4 changed files
with
49 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
29 changes: 29 additions & 0 deletions
29
src/test/ui/debuginfo/debuginfo_with_uninhabitable_field_and_unsized.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 {} |