Skip to content

Add an option to show sizes of used types using -Zprint-type-sizes #861

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tgross35 opened this issue Nov 3, 2022 · 1 comment
Open

Comments

@tgross35
Copy link
Contributor

tgross35 commented Nov 3, 2022

Compiling with cargo +nightly rustc -- -Zprint-type-sizes provides a nice type size printout that would be nice to have on the playground. Example from https://nnethercote.github.io/perf-book/type-sizes.html:

print-type-size type: `E`: 32 bytes, alignment: 8 bytes
print-type-size     discriminant: 1 bytes
print-type-size     variant `D`: 31 bytes
print-type-size         padding: 7 bytes
print-type-size         field `.0`: 24 bytes, alignment: 8 bytes
print-type-size     variant `C`: 23 bytes
...

It would be very handy to be able to quickly see this output in the playground, to help validate layout concerns. All that is needed is an extra button that directly displays the compiler output, or optionally strips the leading print-type-size first.

image

@tgross35
Copy link
Contributor Author

tgross35 commented Sep 6, 2023

Relevant: rust-lang/rust#69852

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant