diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index a8d85fb6fb4ef..b28019e3f91b1 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -1609,6 +1609,7 @@ fn init_id_map() -> FxHashMap, usize> { map.insert("blanket-implementations-list".into(), 1); map.insert("deref-methods".into(), 1); map.insert("layout".into(), 1); + map.insert("aliased-type".into(), 1); map } diff --git a/src/librustdoc/html/render/sidebar.rs b/src/librustdoc/html/render/sidebar.rs index 6466ae825d746..76f63c6f63e36 100644 --- a/src/librustdoc/html/render/sidebar.rs +++ b/src/librustdoc/html/render/sidebar.rs @@ -237,6 +237,7 @@ fn sidebar_type_alias<'a>( ) -> Vec> { let mut items = vec![]; if let Some(inner_type) = &t.inner_type { + items.push(LinkBlock::forced(Link::new("aliased-type", "Aliased type"))); match inner_type { clean::TypeAliasInnerType::Enum { variants, is_non_exhaustive: _ } => { let mut variants = variants diff --git a/tests/rustdoc/issue-32077-type-alias-impls.rs b/tests/rustdoc/issue-32077-type-alias-impls.rs index 26778c67c2433..ac486c36ad044 100644 --- a/tests/rustdoc/issue-32077-type-alias-impls.rs +++ b/tests/rustdoc/issue-32077-type-alias-impls.rs @@ -19,6 +19,8 @@ impl Foo for GenericStruct {} impl Bar for GenericStruct {} // @has 'foo/type.TypedefStruct.html' +// We check that "Aliased type" is also present as a title in the sidebar. +// @has - '//*[@class="sidebar-elems"]//h3/a[@href="#aliased-type"]' 'Aliased type' // We check that we have the implementation of the type alias itself. // @has - '//*[@id="impl-TypedefStruct"]/h3' 'impl TypedefStruct' // @has - '//*[@id="method.on_alias"]/h4' 'pub fn on_alias()'