diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index ca05806d8f9..d6e4b7e4a51 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1281,10 +1281,8 @@ impl Clean for hir::ImplItem { fn clean(&self, cx: &DocContext) -> Item { let inner = match self.node { hir::ImplItemKind::Const(ref ty, ref expr) => { - ConstantItem(Constant{ - type_: ty.clean(cx), - expr: expr.span.to_src(cx), - }) + AssociatedConstItem(ty.clean(cx), + Some(expr.span.to_src(cx))) } hir::ImplItemKind::Method(ref sig, _) => { MethodItem(sig.clean(cx)) diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 12a17afcc7c..b97ccfd3c88 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -2550,25 +2550,25 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi } } clean::TypedefItem(ref tydef, _) => { - let id = derive_id(format!("assoc_type.{}", name)); + let id = derive_id(format!("associatedtype.{}", name)); try!(write!(w, "

", id, shortty(item))); try!(write!(w, "type {} = {}", name, tydef.type_)); try!(write!(w, "

\n")); } clean::AssociatedConstItem(ref ty, ref default) => { - let id = derive_id(format!("assoc_const.{}", name)); + let id = derive_id(format!("associatedconstant.{}", name)); try!(write!(w, "

", id, shortty(item))); try!(assoc_const(w, item, ty, default.as_ref())); try!(write!(w, "

\n")); } clean::ConstantItem(ref c) => { - let id = derive_id(format!("assoc_const.{}", name)); + let id = derive_id(format!("associatedconstant.{}", name)); try!(write!(w, "

", id, shortty(item))); try!(assoc_const(w, item, &c.type_, Some(&c.expr))); try!(write!(w, "

\n")); } clean::AssociatedTypeItem(ref bounds, ref default) => { - let id = derive_id(format!("assoc_type.{}", name)); + let id = derive_id(format!("associatedtype.{}", name)); try!(write!(w, "

", id, shortty(item))); try!(assoc_type(w, item, bounds, default)); try!(write!(w, "

\n")); diff --git a/src/test/rustdoc/assoc-consts.rs b/src/test/rustdoc/assoc-consts.rs index 20d4c744414..8d3f9b59bb2 100644 --- a/src/test/rustdoc/assoc-consts.rs +++ b/src/test/rustdoc/assoc-consts.rs @@ -20,7 +20,7 @@ pub trait Foo { pub struct Bar; impl Bar { - // @has assoc_consts/struct.Bar.html '//*[@id="assoc_const.BAR"]' \ + // @has assoc_consts/struct.Bar.html '//*[@id="associatedconstant.BAR"]' \ // 'const BAR: usize = 3' pub const BAR: usize = 3; } diff --git a/src/test/rustdoc/issue-21092.rs b/src/test/rustdoc/issue-21092.rs index 745c6e2c664..ff48c70fc58 100644 --- a/src/test/rustdoc/issue-21092.rs +++ b/src/test/rustdoc/issue-21092.rs @@ -14,5 +14,5 @@ extern crate issue_21092; // @has issue_21092/struct.Bar.html -// @has - '//*[@id="assoc_type.Bar"]' 'type Bar = i32' +// @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 e4d97828d50..2343b610ce4 100644 --- a/src/test/rustdoc/issue-25001.rs +++ b/src/test/rustdoc/issue-25001.rs @@ -31,21 +31,21 @@ impl Foo { } impl Bar for Foo { - // @has - '//*[@id="assoc_type.Item"]//code' 'type Item = T' + // @has - '//*[@id="associatedtype.Item"]//code' 'type Item = T' type Item=T; // @has - '//*[@id="method.quux"]//code' 'fn quux(self)' fn quux(self) {} } impl<'a, T> Bar for &'a Foo { - // @has - '//*[@id="assoc_type.Item-1"]//code' "type Item = &'a T" + // @has - '//*[@id="associatedtype.Item-1"]//code' "type Item = &'a T" type Item=&'a T; // @has - '//*[@id="method.quux-1"]//code' 'fn quux(self)' fn quux(self) {} } impl<'a, T> Bar for &'a mut Foo { - // @has - '//*[@id="assoc_type.Item-2"]//code' "type Item = &'a mut T" + // @has - '//*[@id="associatedtype.Item-2"]//code' "type Item = &'a mut T" type Item=&'a mut T; // @has - '//*[@id="method.quux-2"]//code' 'fn quux(self)'