forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
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#69901 - RalfJung:rustc_layout, r=eddyb
add #[rustc_layout(debug)] @eddyb recently told me about the `#[rustc_layout]` attribute, and I think it would be very useful if it could be used to print all the layout information Rust has about a type. When working with layouts (e.g. in Miri), it is often not clear how certain surface language features get represented internally. I have some awful hacks locally to be able to dump this debug information; with this attribute I could get it on the playground which is so much better. :)
- Loading branch information
Showing
4 changed files
with
371 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -253,6 +253,7 @@ symbols! { | |
debug_trait, | ||
declare_lint_pass, | ||
decl_macro, | ||
debug, | ||
Debug, | ||
Decodable, | ||
Default, | ||
|
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,14 @@ | ||
#![feature(never_type, rustc_attrs)] | ||
#![crate_type = "lib"] | ||
|
||
#[rustc_layout(debug)] | ||
enum E { Foo, Bar(!, i32, i32) } //~ ERROR: layout debugging | ||
|
||
#[rustc_layout(debug)] | ||
struct S { f1: i32, f2: (), f3: i32 } //~ ERROR: layout debugging | ||
|
||
#[rustc_layout(debug)] | ||
union U { f1: (i32, i32), f3: i32 } //~ ERROR: layout debugging | ||
|
||
#[rustc_layout(debug)] | ||
type Test = Result<i32, i32>; //~ ERROR: layout debugging |
Oops, something went wrong.