Rollup merge of #99700 - est31:rustdoc_layout_heading, r=GuillaumeGomez
Add a clickable link to the layout section The layout section (activated by `--show-type-layout`) is currently not linkable to (outside of chrome's link to text feature). This PR makes it linkable via `#layout`.
This commit is contained in:
commit
181bf05d86
@ -1485,6 +1485,7 @@ fn init_id_map() -> FxHashMap<Cow<'static, str>, usize> {
|
|||||||
map.insert("synthetic-implementations-list".into(), 1);
|
map.insert("synthetic-implementations-list".into(), 1);
|
||||||
map.insert("blanket-implementations-list".into(), 1);
|
map.insert("blanket-implementations-list".into(), 1);
|
||||||
map.insert("deref-methods".into(), 1);
|
map.insert("deref-methods".into(), 1);
|
||||||
|
map.insert("layout".into(), 1);
|
||||||
map
|
map
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1880,7 +1880,11 @@ fn document_type_layout(w: &mut Buffer, cx: &Context<'_>, ty_def_id: DefId) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
writeln!(w, "<h2 class=\"small-section-header\">Layout</h2>");
|
writeln!(
|
||||||
|
w,
|
||||||
|
"<h2 id=\"layout\" class=\"small-section-header\"> \
|
||||||
|
Layout<a href=\"#layout\" class=\"anchor\"></a></h2>"
|
||||||
|
);
|
||||||
writeln!(w, "<div class=\"docblock\">");
|
writeln!(w, "<div class=\"docblock\">");
|
||||||
|
|
||||||
let tcx = cx.tcx();
|
let tcx = cx.tcx();
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
// @has type_layout/struct.Foo.html 'Size: '
|
// @has type_layout/struct.Foo.html 'Size: '
|
||||||
// @has - ' bytes'
|
// @has - ' bytes'
|
||||||
|
// @has - '//*[@id="layout"]/a[@href="#layout"]' ''
|
||||||
pub struct Foo {
|
pub struct Foo {
|
||||||
pub a: usize,
|
pub a: usize,
|
||||||
b: Vec<String>,
|
b: Vec<String>,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user