Skip to content
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

rustdoc: Show type layout for type aliases #91682

Merged
merged 1 commit into from
Dec 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/librustdoc/html/render/print_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,7 @@ fn item_typedef(
// associated items from the aliased type (see discussion in #32077), but
// we need #14072 to make sense of the generics.
render_assoc_items(w, cx, it, def_id, AssocItemRender::All);
document_type_layout(w, cx, def_id);
}

fn item_union(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, s: &clean::Union) {
Expand Down
12 changes: 12 additions & 0 deletions src/test/rustdoc/type-layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ pub struct GenericLifetimes<'a>(&'a str);
// @has - '(unsized)'
pub struct Unsized([u8]);

// @has type_layout/type.TypeAlias.html 'Size: '
// @has - ' bytes'
pub type TypeAlias = X;

// @has type_layout/type.GenericTypeAlias.html 'Size: '
// @has - '8 bytes'
pub type GenericTypeAlias = (Generic<(u32, ())>, Generic<u32>);

// Regression test for the rustdoc equivalent of #85103.
// @has type_layout/type.Edges.html 'Encountered an error during type layout; the type failed to be normalized.'
pub type Edges<'a, E> = std::borrow::Cow<'a, [E]>;

// @!has type_layout/trait.MyTrait.html 'Size: '
pub trait MyTrait {}

Expand Down