diff options
| author | Corey Farwell <coreyf@rwell.org> | 2017-08-26 06:46:33 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-08-26 06:46:33 -0700 |
| commit | b4dcdee0fd7b9996ca44ca1241ee60f863f4e4d3 (patch) | |
| tree | 498de2ab21b7285fdc1a0f17b339d91f3191ff09 /src | |
| parent | e9a6dccce0351b6484f25dcf5ee7dd6a71fbea7a (diff) | |
| parent | 4729f22f8b3cc9faaf147909c6fbec3f9e434d4c (diff) | |
| download | rust-b4dcdee0fd7b9996ca44ca1241ee60f863f4e4d3.tar.gz rust-b4dcdee0fd7b9996ca44ca1241ee60f863f4e4d3.zip | |
Rollup merge of #43979 - Jouan:Add-links-for-impls, r=GuillaumeGomez
Add links for impls Implements a solution for issue #23552 r? @QuietMisdreavus
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/html/render.rs | 8 | ||||
| -rw-r--r-- | src/librustdoc/html/static/rustdoc.css | 4 | ||||
| -rw-r--r-- | src/librustdoc/html/static/styles/main.css | 6 |
3 files changed, 17 insertions, 1 deletions
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index e113165b9ab..5457f69cb6d 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -2956,7 +2956,13 @@ fn render_deref_methods(w: &mut fmt::Formatter, cx: &Context, impl_: &Impl, fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLink, render_mode: RenderMode, outer_version: Option<&str>) -> fmt::Result { if render_mode == RenderMode::Normal { - write!(w, "<h3 class='impl'><span class='in-band'><code>{}</code>", i.inner_impl())?; + let id = derive_id(match i.inner_impl().trait_ { + Some(ref t) => format!("impl-{}", Escape(&format!("{:#}", t))), + None => "impl".to_string(), + }); + write!(w, "<h3 id='{}' class='impl'><span class='in-band'><code>{}</code>", + id, i.inner_impl())?; + write!(w, "<a href='#{}' class='anchor'></a>", id)?; write!(w, "</span><span class='out-of-band'>")?; let since = i.impl_item.stability.as_ref().map(|s| &s.since[..]); if let Some(l) = (Item { item: &i.impl_item, cx: cx }).src_href() { diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index 26a64f6cd22..4a3286b421a 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -445,6 +445,10 @@ a { .small-section-header:hover > .anchor { display: initial; } + +.in-band:hover > .anchor { + display: initial; +} .anchor { display: none; } diff --git a/src/librustdoc/html/static/styles/main.css b/src/librustdoc/html/static/styles/main.css index 08bf5a10fe9..c5f4272b932 100644 --- a/src/librustdoc/html/static/styles/main.css +++ b/src/librustdoc/html/static/styles/main.css @@ -26,6 +26,7 @@ h1.fqn { h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.type):not(.tymethod) { border-bottom-color: #DDDDDD; } + .in-band { background-color: white; } @@ -83,6 +84,11 @@ pre { } :target { background: #FDFFD3; } + +:target > .in-band { + background: #FDFFD3; +} + .content .highlighted { color: #000 !important; background-color: #ccc; |
