-
Notifications
You must be signed in to change notification settings - Fork 13.7k
add #[rustc_layout(debug)] #69901
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
add #[rustc_layout(debug)] #69901
Conversation
r? @cramertj (rust_highfive has picked a reviewer for you, use r? to override) |
Cool! This will be helpful for testing generator layout optimizations in the future. |
I figured it would be useful for tons of stuff. :) We have to think of some ways to make sure that the right people even know about it... like finding a good place in the rustc dev guide to mention it. I also plan to write a blog post. |
cc @rust-lang/compiler |
r? @eddyb |
@eddyb I made this work on type definitions, not just type aliases. |
@bors r+ Thanks! |
📌 Commit c62e36b has been approved by |
This comment has been minimized.
This comment has been minimized.
@bors r- (failed because formatting) |
Fixed that. @bors r=eddyb |
📌 Commit 7b49678 has been approved by |
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. :)
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. :)
Failed in #70203 (comment), @bors r- |
Looks like "preferred alignment" differs for some platforms:
@eddyb should I just normalize all |
@RalfJung Does this work? |
Yes that works, nice. @bors r=eddyb |
📌 Commit e548df7 has been approved by |
Rollup of 6 pull requests Successful merges: - rust-lang#69497 (Don't unwind when hitting the macro expansion recursion limit) - rust-lang#69901 (add #[rustc_layout(debug)]) - rust-lang#69910 (Avoid query type in generics) - rust-lang#69955 (Fix abort-on-eprintln during process shutdown) - rust-lang#70032 (put type params in front of const params in generics_of) - rust-lang#70119 (rustc: use LocalDefId instead of DefId in TypeckTables.) Failed merges: r? @ghost
That's awesome! |
@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. :)