-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-alignArea: alignment control (`repr(align(N))` and so on)Area: alignment control (`repr(align(N))` and so on)A-rustdoc-type-layoutArea: `rustdoc --show-type-layout` (nightly-only)Area: `rustdoc --show-type-layout` (nightly-only)C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.
Description
Problem
It can be tedious to query the size/alignment of non-generic types (struct, enum, union), which one might want to do for many reasons. Currently, you have to do one of the following:
- Compile a crate that has access to the type in question and print the value.
- Print the value from the playground, if the crate is available there (which probably wont be the case for anything you're currently working on.)
- Inspect compiler output via
-Zprint-type-sizes
.
All of these have the problem of having to compile code to get an answer.
Proposed Solution
The ideal solution would be to display the size & alignment of types in the cargo doc
generated output, so you wouldn't have to build a crate.
Notes
I have no idea how feasible this is, but given that cargo doc
already compiles and runs doc tests, it doesn't seem unreasonable.
Metadata
Metadata
Assignees
Labels
A-alignArea: alignment control (`repr(align(N))` and so on)Area: alignment control (`repr(align(N))` and so on)A-rustdoc-type-layoutArea: `rustdoc --show-type-layout` (nightly-only)Area: `rustdoc --show-type-layout` (nightly-only)C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.