diff options
| author | bors <bors@rust-lang.org> | 2016-02-13 19:28:09 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-02-13 19:28:09 +0000 |
| commit | c438802aa7a90be2e47fc2c7e6c4dd6f8b80c5af (patch) | |
| tree | f9ec4446b2b63050df944c4aba7bdc8897382461 /src | |
| parent | bc9192738da6484e4592e5d597a53256be56cdd7 (diff) | |
| parent | 938202c81f309d78925516e13f119a5f1112a62b (diff) | |
| download | rust-c438802aa7a90be2e47fc2c7e6c4dd6f8b80c5af.tar.gz rust-c438802aa7a90be2e47fc2c7e6c4dd6f8b80c5af.zip | |
Auto merge of #31596 - mitaa:rdoc_assoc_item, r=alexcrichton
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/clean/mod.rs | 6 | ||||
| -rw-r--r-- | src/librustdoc/html/render.rs | 8 | ||||
| -rw-r--r-- | src/test/rustdoc/assoc-consts.rs | 2 | ||||
| -rw-r--r-- | src/test/rustdoc/issue-21092.rs | 2 | ||||
| -rw-r--r-- | src/test/rustdoc/issue-25001.rs | 6 |
5 files changed, 11 insertions, 13 deletions
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<Item> 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, "<h4 id='{}' class='{}'><code>", id, shortty(item))); try!(write!(w, "type {} = {}", name, tydef.type_)); try!(write!(w, "</code></h4>\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, "<h4 id='{}' class='{}'><code>", id, shortty(item))); try!(assoc_const(w, item, ty, default.as_ref())); try!(write!(w, "</code></h4>\n")); } clean::ConstantItem(ref c) => { - let id = derive_id(format!("assoc_const.{}", name)); + let id = derive_id(format!("associatedconstant.{}", name)); try!(write!(w, "<h4 id='{}' class='{}'><code>", id, shortty(item))); try!(assoc_const(w, item, &c.type_, Some(&c.expr))); try!(write!(w, "</code></h4>\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, "<h4 id='{}' class='{}'><code>", id, shortty(item))); try!(assoc_type(w, item, bounds, default)); try!(write!(w, "</code></h4>\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<T> Foo<T> { } impl<T> Bar for Foo<T> { - // @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<T> { - // @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<T> { - // @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)' |
