\
- {f}: {t} | ",
- v = variant.name.as_ref().unwrap(),
+ id='{id}'>\
+ \
+ {f}: {t} | ",
+ id = id,
+ ns_id = ns_id,
f = field.name.as_ref().unwrap(),
t = *ty)?;
document(w, cx, field)?;
@@ -2584,11 +2630,11 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
}
}
- fn doctraititem(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item,
- link: AssocItemLink, render_static: bool,
- is_default_item: bool, outer_version: Option<&str>,
- trait_: Option<&clean::Trait>) -> fmt::Result {
- let shortty = shortty(item);
+ fn doc_impl_item(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item,
+ link: AssocItemLink, render_static: bool,
+ is_default_item: bool, outer_version: Option<&str>,
+ trait_: Option<&clean::Trait>) -> fmt::Result {
+ let item_type = item_type(item);
let name = item.name.as_ref().unwrap();
let is_static = match item.inner {
@@ -2601,38 +2647,48 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
clean::MethodItem(..) | clean::TyMethodItem(..) => {
// Only render when the method is not static or we allow static methods
if !is_static || render_static {
- let id = derive_id(format!("{}.{}", shortty, name));
- write!(w, "", id, shortty)?;
+ let id = derive_id(format!("{}.{}", item_type, name));
+ let ns_id = derive_id(format!("{}.{}", name, item_type.name_space()));
+ write!(w, "", id, item_type)?;
+ write!(w, "", ns_id)?;
write!(w, "")?;
render_assoc_item(w, item, link.anchor(&id))?;
write!(w, " ")?;
render_stability_since_raw(w, item.stable_since(), outer_version)?;
- write!(w, "\n")?;
+ write!(w, "\n")?;
}
}
clean::TypedefItem(ref tydef, _) => {
let id = derive_id(format!("{}.{}", ItemType::AssociatedType, name));
- write!(w, "", id, shortty)?;
+ let ns_id = derive_id(format!("{}.{}", name, item_type.name_space()));
+ write!(w, "", id, item_type)?;
+ write!(w, "", ns_id)?;
assoc_type(w, item, &Vec::new(), Some(&tydef.type_), link.anchor(&id))?;
- write!(w, " \n")?;
+ write!(w, " \n")?;
}
clean::AssociatedConstItem(ref ty, ref default) => {
- let id = derive_id(format!("{}.{}", shortty, name));
- write!(w, "", id, shortty)?;
+ let id = derive_id(format!("{}.{}", item_type, name));
+ let ns_id = derive_id(format!("{}.{}", name, item_type.name_space()));
+ write!(w, "", id, item_type)?;
+ write!(w, "", ns_id)?;
assoc_const(w, item, ty, default.as_ref(), link.anchor(&id))?;
- write!(w, " \n")?;
+ write!(w, " \n")?;
}
clean::ConstantItem(ref c) => {
- let id = derive_id(format!("{}.{}", shortty, name));
- write!(w, "", id, shortty)?;
+ let id = derive_id(format!("{}.{}", item_type, name));
+ let ns_id = derive_id(format!("{}.{}", name, item_type.name_space()));
+ write!(w, "", id, item_type)?;
+ write!(w, "", ns_id)?;
assoc_const(w, item, &c.type_, Some(&c.expr), link.anchor(&id))?;
- write!(w, " \n")?;
+ write!(w, " \n")?;
}
clean::AssociatedTypeItem(ref bounds, ref default) => {
- let id = derive_id(format!("{}.{}", shortty, name));
- write!(w, "", id, shortty)?;
+ let id = derive_id(format!("{}.{}", item_type, name));
+ let ns_id = derive_id(format!("{}.{}", name, item_type.name_space()));
+ write!(w, "", id, item_type)?;
+ write!(w, "", ns_id)?;
assoc_type(w, item, bounds, default.as_ref(), link.anchor(&id))?;
- write!(w, " \n")?;
+ write!(w, " \n")?;
}
clean::StrippedItem(..) => return Ok(()),
_ => panic!("can't make docs for trait item with name {:?}", item.name)
@@ -2671,8 +2727,8 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
write!(w, "")?;
for trait_item in &i.inner_impl().items {
- doctraititem(w, cx, trait_item, link, render_header,
- false, outer_version, trait_)?;
+ doc_impl_item(w, cx, trait_item, link, render_header,
+ false, outer_version, trait_)?;
}
fn render_default_items(w: &mut fmt::Formatter,
@@ -2689,8 +2745,8 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
let did = i.trait_.as_ref().unwrap().def_id().unwrap();
let assoc_link = AssocItemLink::GotoSource(did, &i.provided_trait_methods);
- doctraititem(w, cx, trait_item, assoc_link, render_static, true,
- outer_version, None)?;
+ doc_impl_item(w, cx, trait_item, assoc_link, render_static, true,
+ outer_version, None)?;
}
Ok(())
}
@@ -2749,7 +2805,7 @@ impl<'a> fmt::Display for Sidebar<'a> {
relpath: '{path}'\
}};",
name = it.name.as_ref().map(|x| &x[..]).unwrap_or(""),
- ty = shortty(it).to_static_str(),
+ ty = item_type(it).css_class(),
path = relpath)?;
if parentlen == 0 {
// there is no sidebar-items.js beyond the crate root path
diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css
index de0457592fc..c97cacd10c3 100644
--- a/src/librustdoc/html/static/rustdoc.css
+++ b/src/librustdoc/html/static/rustdoc.css
@@ -284,7 +284,7 @@ h3.impl > .out-of-band {
font-size: 21px;
}
-h4 > code, h3 > code {
+h4 > code, h3 > code, invisible > code {
position: inherit;
}
@@ -292,6 +292,12 @@ h4 > code, h3 > code {
z-index: 5;
}
+.invisible {
+ background: rgba(0, 0, 0, 0);
+ width: 100%;
+ display: inline-block;
+}
+
.content .in-band {
margin: 0px;
padding: 0px;
@@ -660,6 +666,7 @@ span.since {
:target > code {
background: #FDFFD3;
+ opacity: 1;
}
/* Media Queries */
diff --git a/src/librustdoc/html/static/styles/main.css b/src/librustdoc/html/static/styles/main.css
index aee6d15b7ca..c64fb1b67f3 100644
--- a/src/librustdoc/html/static/styles/main.css
+++ b/src/librustdoc/html/static/styles/main.css
@@ -26,7 +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, code {
+.in-band {
background-color: white;
}
diff --git a/src/test/rustdoc/assoc-types.rs b/src/test/rustdoc/assoc-types.rs
index d5047ade062..e5485c356c2 100644
--- a/src/test/rustdoc/assoc-types.rs
+++ b/src/test/rustdoc/assoc-types.rs
@@ -13,7 +13,9 @@
// @has assoc_types/trait.Index.html
pub trait Index {
// @has - '//*[@id="associatedtype.Output"]//code' 'type Output: ?Sized'
+ // @has - '//*[@id="Output.t"]//code' 'type Output: ?Sized'
type Output: ?Sized;
+ // @has - '//*[@id="index.v"]//code' 'fn index'
// @has - '//*[@id="tymethod.index"]//code' \
// "fn index<'a>(&'a self, index: I) -> &'a Self::Output"
fn index<'a>(&'a self, index: I) -> &'a Self::Output;
diff --git a/src/test/rustdoc/issue-19190.rs b/src/test/rustdoc/issue-19190.rs
index 6289fcc6fe5..15f7528b4ba 100644
--- a/src/test/rustdoc/issue-19190.rs
+++ b/src/test/rustdoc/issue-19190.rs
@@ -23,6 +23,9 @@ impl Deref for Bar {
fn deref(&self) -> &Foo { loop {} }
}
+// @has issue_19190/Bar.t.html
// @has issue_19190/struct.Bar.html
+// @has - '//*[@id="foo.v"]' 'fn foo(&self)'
// @has - '//*[@id="method.foo"]' 'fn foo(&self)'
+// @!has - '//*[@id="static_foo.v"]' 'fn static_foo()'
// @!has - '//*[@id="method.static_foo"]' 'fn static_foo()'
diff --git a/src/test/rustdoc/issue-21092.rs b/src/test/rustdoc/issue-21092.rs
index ff48c70fc58..8c5bda7584c 100644
--- a/src/test/rustdoc/issue-21092.rs
+++ b/src/test/rustdoc/issue-21092.rs
@@ -13,6 +13,7 @@
extern crate issue_21092;
+// @has issue_21092/Bar.t.html
// @has issue_21092/struct.Bar.html
// @has - '//*[@id="associatedtype.Bar"]' 'type Bar = i32'
pub use issue_21092::{Foo, Bar};
diff --git a/src/test/rustdoc/issue-25001.rs b/src/test/rustdoc/issue-25001.rs
index 25c97ee2c76..0b6a8104661 100644
--- a/src/test/rustdoc/issue-25001.rs
+++ b/src/test/rustdoc/issue-25001.rs
@@ -19,14 +19,17 @@ pub trait Bar {
impl Foo {
// @has - '//*[@id="method.pass"]//code' 'fn pass()'
+ // @has - '//*[@id="pass.v"]//code' 'fn pass()'
pub fn pass() {}
}
impl Foo {
// @has - '//*[@id="method.pass-1"]//code' 'fn pass() -> usize'
+ // @has - '//*[@id="pass.v-1"]//code' 'fn pass() -> usize'
pub fn pass() -> usize { 42 }
}
impl Foo {
// @has - '//*[@id="method.pass-2"]//code' 'fn pass() -> isize'
+ // @has - '//*[@id="pass.v-2"]//code' 'fn pass() -> isize'
pub fn pass() -> isize { 42 }
}
diff --git a/src/test/rustdoc/src-links.rs b/src/test/rustdoc/src-links.rs
index 4d7dad64b47..e946e242316 100644
--- a/src/test/rustdoc/src-links.rs
+++ b/src/test/rustdoc/src-links.rs
@@ -24,11 +24,13 @@ pub mod bar {
// @has foo/bar/baz/index.html '//a/@href' '../../../src/foo/src-links.rs.html'
pub mod baz {
/// Dox
+ // @has foo/bar/baz/baz.v.html
// @has foo/bar/baz/fn.baz.html '//a/@href' '../../../src/foo/src-links.rs.html'
pub fn baz() { }
}
/// Dox
+ // @has foo/bar/Foobar.t.html
// @has foo/bar/trait.Foobar.html '//a/@href' '../../src/foo/src-links.rs.html'
pub trait Foobar { fn dummy(&self) { } }
diff --git a/src/test/rustdoc/structfields.rs b/src/test/rustdoc/structfields.rs
index c4327f70728..c0bfe3ffe3c 100644
--- a/src/test/rustdoc/structfields.rs
+++ b/src/test/rustdoc/structfields.rs
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// @has structfields/Foo.t.html
+// @has - struct.Foo.html
// @has structfields/struct.Foo.html
pub struct Foo {
// @has - //pre "pub a: ()"
@@ -22,6 +24,8 @@ pub struct Foo {
pub d: usize,
}
+// @has structfields/Bar.t.html
+// @has - struct.Bar.html
// @has structfields/struct.Bar.html
pub struct Bar {
// @has - //pre "pub a: ()"
@@ -29,6 +33,8 @@ pub struct Bar {
// @!has - //pre "// some fields omitted"
}
+// @has structfields/Qux.t.html
+// @has - enum.Qux.html
// @has structfields/enum.Qux.html
pub enum Qux {
Quz {
|