rust-playground icon indicating copy to clipboard operation
rust-playground copied to clipboard

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

Open tgross35 opened this issue 2 years ago • 1 comments

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 avatar Nov 03 '22 07:11 tgross35

Relevant: https://github.com/rust-lang/rust/issues/69852

tgross35 avatar Sep 06 '23 01:09 tgross35