mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
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("blanket-implementations-list".into(), 1);
|
||||
map.insert("deref-methods".into(), 1);
|
||||
map.insert("layout".into(), 1);
|
||||
map
|
||||
}
|
||||
|
||||
|
@ -1880,7 +1880,11 @@ fn document_type_layout(w: &mut Buffer, cx: &Context<'_>, ty_def_id: DefId) {
|
||||
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\">");
|
||||
|
||||
let tcx = cx.tcx();
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
// @has type_layout/struct.Foo.html 'Size: '
|
||||
// @has - ' bytes'
|
||||
// @has - '//*[@id="layout"]/a[@href="#layout"]' ''
|
||||
pub struct Foo {
|
||||
pub a: usize,
|
||||
b: Vec<String>,
|
||||
|
Loading…
Reference in New Issue
Block a user