Skip to content

Commit c438802

Browse files
committed
Auto merge of #31596 - mitaa:rdoc_assoc_item, r=alexcrichton
2 parents bc91927 + 938202c commit c438802

File tree

5 files changed

+11
-13
lines changed

5 files changed

+11
-13
lines changed

src/librustdoc/clean/mod.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1281,10 +1281,8 @@ impl Clean<Item> for hir::ImplItem {
12811281
fn clean(&self, cx: &DocContext) -> Item {
12821282
let inner = match self.node {
12831283
hir::ImplItemKind::Const(ref ty, ref expr) => {
1284-
ConstantItem(Constant{
1285-
type_: ty.clean(cx),
1286-
expr: expr.span.to_src(cx),
1287-
})
1284+
AssociatedConstItem(ty.clean(cx),
1285+
Some(expr.span.to_src(cx)))
12881286
}
12891287
hir::ImplItemKind::Method(ref sig, _) => {
12901288
MethodItem(sig.clean(cx))

src/librustdoc/html/render.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -2550,25 +2550,25 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
25502550
}
25512551
}
25522552
clean::TypedefItem(ref tydef, _) => {
2553-
let id = derive_id(format!("assoc_type.{}", name));
2553+
let id = derive_id(format!("associatedtype.{}", name));
25542554
try!(write!(w, "<h4 id='{}' class='{}'><code>", id, shortty(item)));
25552555
try!(write!(w, "type {} = {}", name, tydef.type_));
25562556
try!(write!(w, "</code></h4>\n"));
25572557
}
25582558
clean::AssociatedConstItem(ref ty, ref default) => {
2559-
let id = derive_id(format!("assoc_const.{}", name));
2559+
let id = derive_id(format!("associatedconstant.{}", name));
25602560
try!(write!(w, "<h4 id='{}' class='{}'><code>", id, shortty(item)));
25612561
try!(assoc_const(w, item, ty, default.as_ref()));
25622562
try!(write!(w, "</code></h4>\n"));
25632563
}
25642564
clean::ConstantItem(ref c) => {
2565-
let id = derive_id(format!("assoc_const.{}", name));
2565+
let id = derive_id(format!("associatedconstant.{}", name));
25662566
try!(write!(w, "<h4 id='{}' class='{}'><code>", id, shortty(item)));
25672567
try!(assoc_const(w, item, &c.type_, Some(&c.expr)));
25682568
try!(write!(w, "</code></h4>\n"));
25692569
}
25702570
clean::AssociatedTypeItem(ref bounds, ref default) => {
2571-
let id = derive_id(format!("assoc_type.{}", name));
2571+
let id = derive_id(format!("associatedtype.{}", name));
25722572
try!(write!(w, "<h4 id='{}' class='{}'><code>", id, shortty(item)));
25732573
try!(assoc_type(w, item, bounds, default));
25742574
try!(write!(w, "</code></h4>\n"));

src/test/rustdoc/assoc-consts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub trait Foo {
2020
pub struct Bar;
2121

2222
impl Bar {
23-
// @has assoc_consts/struct.Bar.html '//*[@id="assoc_const.BAR"]' \
23+
// @has assoc_consts/struct.Bar.html '//*[@id="associatedconstant.BAR"]' \
2424
// 'const BAR: usize = 3'
2525
pub const BAR: usize = 3;
2626
}

src/test/rustdoc/issue-21092.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414
extern crate issue_21092;
1515

1616
// @has issue_21092/struct.Bar.html
17-
// @has - '//*[@id="assoc_type.Bar"]' 'type Bar = i32'
17+
// @has - '//*[@id="associatedtype.Bar"]' 'type Bar = i32'
1818
pub use issue_21092::{Foo, Bar};

src/test/rustdoc/issue-25001.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,21 @@ impl<T> Foo<T> {
3131
}
3232

3333
impl<T> Bar for Foo<T> {
34-
// @has - '//*[@id="assoc_type.Item"]//code' 'type Item = T'
34+
// @has - '//*[@id="associatedtype.Item"]//code' 'type Item = T'
3535
type Item=T;
3636

3737
// @has - '//*[@id="method.quux"]//code' 'fn quux(self)'
3838
fn quux(self) {}
3939
}
4040
impl<'a, T> Bar for &'a Foo<T> {
41-
// @has - '//*[@id="assoc_type.Item-1"]//code' "type Item = &'a T"
41+
// @has - '//*[@id="associatedtype.Item-1"]//code' "type Item = &'a T"
4242
type Item=&'a T;
4343

4444
// @has - '//*[@id="method.quux-1"]//code' 'fn quux(self)'
4545
fn quux(self) {}
4646
}
4747
impl<'a, T> Bar for &'a mut Foo<T> {
48-
// @has - '//*[@id="assoc_type.Item-2"]//code' "type Item = &'a mut T"
48+
// @has - '//*[@id="associatedtype.Item-2"]//code' "type Item = &'a mut T"
4949
type Item=&'a mut T;
5050

5151
// @has - '//*[@id="method.quux-2"]//code' 'fn quux(self)'

0 commit comments

Comments
 (0)