Skip to content

Commit 499e024

Browse files
pierwillcamelid
authored andcommitted
rustdoc: Add more semantic information to impl ids
Instead of generating `#impl`, `#impl-1`, etc., generate IDs like `#impl-Foo<M>`. Co-authored-by: Noah Lev <[email protected]>
1 parent 54f79ba commit 499e024

18 files changed

+49
-68
lines changed

src/librustdoc/html/render/mod.rs

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,6 @@ fn render_impls(
634634
&[],
635635
ImplRenderingParameters {
636636
show_def_docs: true,
637-
is_on_foreign_type: false,
638637
show_default_items: true,
639638
show_non_assoc_items: true,
640639
toggle_open_by_default,
@@ -1071,7 +1070,6 @@ fn render_assoc_items_inner(
10711070
&[],
10721071
ImplRenderingParameters {
10731072
show_def_docs: true,
1074-
is_on_foreign_type: false,
10751073
show_default_items: true,
10761074
show_non_assoc_items: true,
10771075
toggle_open_by_default: true,
@@ -1287,7 +1285,6 @@ fn notable_traits_decl(decl: &clean::FnDecl, cx: &Context<'_>) -> String {
12871285
#[derive(Clone, Copy, Debug)]
12881286
struct ImplRenderingParameters {
12891287
show_def_docs: bool,
1290-
is_on_foreign_type: bool,
12911288
show_default_items: bool,
12921289
/// Whether or not to show methods.
12931290
show_non_assoc_items: bool,
@@ -1603,7 +1600,6 @@ fn render_impl(
16031600
parent,
16041601
rendering_params.show_def_docs,
16051602
use_absolute,
1606-
rendering_params.is_on_foreign_type,
16071603
aliases,
16081604
);
16091605
if toggled {
@@ -1688,21 +1684,12 @@ pub(crate) fn render_impl_summary(
16881684
containing_item: &clean::Item,
16891685
show_def_docs: bool,
16901686
use_absolute: Option<bool>,
1691-
is_on_foreign_type: bool,
16921687
// This argument is used to reference same type with different paths to avoid duplication
16931688
// in documentation pages for trait with automatic implementations like "Send" and "Sync".
16941689
aliases: &[String],
16951690
) {
1696-
let id = cx.derive_id(match i.inner_impl().trait_ {
1697-
Some(ref t) => {
1698-
if is_on_foreign_type {
1699-
get_id_for_impl_on_foreign_type(&i.inner_impl().for_, t, cx)
1700-
} else {
1701-
format!("impl-{}", small_url_encode(format!("{:#}", t.print(cx))))
1702-
}
1703-
}
1704-
None => "impl".to_string(),
1705-
});
1691+
let id =
1692+
cx.derive_id(get_id_for_impl(&i.inner_impl().for_, i.inner_impl().trait_.as_ref(), cx));
17061693
let aliases = if aliases.is_empty() {
17071694
String::new()
17081695
} else {
@@ -2147,12 +2134,11 @@ fn sidebar_struct(cx: &Context<'_>, buf: &mut Buffer, it: &clean::Item, s: &clea
21472134
}
21482135
}
21492136

2150-
fn get_id_for_impl_on_foreign_type(
2151-
for_: &clean::Type,
2152-
trait_: &clean::Path,
2153-
cx: &Context<'_>,
2154-
) -> String {
2155-
small_url_encode(format!("impl-{:#}-for-{:#}", trait_.print(cx), for_.print(cx)))
2137+
fn get_id_for_impl(for_: &clean::Type, trait_: Option<&clean::Path>, cx: &Context<'_>) -> String {
2138+
match trait_ {
2139+
Some(t) => small_url_encode(format!("impl-{:#}-for-{:#}", t.print(cx), for_.print(cx))),
2140+
None => small_url_encode(format!("impl-{:#}", for_.print(cx))),
2141+
}
21562142
}
21572143

21582144
fn extract_for_impl_name(item: &clean::Item, cx: &Context<'_>) -> Option<(String, String)> {
@@ -2161,10 +2147,7 @@ fn extract_for_impl_name(item: &clean::Item, cx: &Context<'_>) -> Option<(String
21612147
i.trait_.as_ref().map(|trait_| {
21622148
// Alternative format produces no URLs,
21632149
// so this parameter does nothing.
2164-
(
2165-
format!("{:#}", i.for_.print(cx)),
2166-
get_id_for_impl_on_foreign_type(&i.for_, trait_, cx),
2167-
)
2150+
(format!("{:#}", i.for_.print(cx)), get_id_for_impl(&i.for_, Some(trait_), cx))
21682151
})
21692152
}
21702153
_ => None,

src/librustdoc/html/render/print_item.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,6 @@ fn item_trait(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean:
853853
&[],
854854
ImplRenderingParameters {
855855
show_def_docs: false,
856-
is_on_foreign_type: true,
857856
show_default_items: false,
858857
show_non_assoc_items: true,
859858
toggle_open_by_default: false,
@@ -1627,7 +1626,6 @@ fn render_implementor(
16271626
aliases,
16281627
ImplRenderingParameters {
16291628
show_def_docs: false,
1630-
is_on_foreign_type: false,
16311629
show_default_items: false,
16321630
show_non_assoc_items: false,
16331631
toggle_open_by_default: false,

src/test/rustdoc-gui/anchors.goml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ move-cursor-to: "h2#implementations"
2828
assert-css: ("h2#implementations a.anchor", {"color": "rgb(0, 0, 0)"})
2929

3030
// Same thing with the impl block title.
31-
move-cursor-to: "#impl"
32-
assert-css: ("#impl a.anchor", {"color": "rgb(0, 0, 0)"})
31+
move-cursor-to: "#impl-HeavilyDocumentedStruct"
32+
assert-css: ("#impl-HeavilyDocumentedStruct a.anchor", {"color": "rgb(0, 0, 0)"})
3333

3434
assert-css: ("#title-for-struct-impl-item-doc", {"margin-left": "0px"})

src/test/rustdoc-gui/headers-color.goml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ assert-css: (
2323
ALL,
2424
)
2525

26-
goto: file://|DOC_PATH|/test_docs/struct.Foo.html#impl
26+
goto: file://|DOC_PATH|/test_docs/struct.Foo.html#impl-Foo
2727
assert-css: (
28-
"#impl",
28+
"#impl-Foo",
2929
{"color": "rgb(197, 197, 197)", "background-color": "rgba(255, 236, 164, 0.06)"},
3030
)
3131

@@ -62,9 +62,9 @@ assert-css: (
6262
ALL,
6363
)
6464

65-
goto: file://|DOC_PATH|/test_docs/struct.Foo.html#impl
65+
goto: file://|DOC_PATH|/test_docs/struct.Foo.html#impl-Foo
6666
assert-css: (
67-
"#impl",
67+
"#impl-Foo",
6868
{"color": "rgb(221, 221, 221)", "background-color": "rgb(73, 74, 61)"},
6969
)
7070

@@ -99,8 +99,8 @@ assert-css: (
9999
ALL,
100100
)
101101

102-
goto: file://|DOC_PATH|/test_docs/struct.Foo.html#impl
103-
assert-css: ("#impl", {"color": "rgb(0, 0, 0)", "background-color": "rgb(253, 255, 211)"})
102+
goto: file://|DOC_PATH|/test_docs/struct.Foo.html#impl-Foo
103+
assert-css: ("#impl-Foo", {"color": "rgb(0, 0, 0)", "background-color": "rgb(253, 255, 211)"})
104104

105105
goto: file://|DOC_PATH|/test_docs/struct.Foo.html#method.must_use
106106
assert-css: (

src/test/rustdoc-gui/headings.goml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ assert-css: ("h4#sub-heading-for-field", {"border-bottom-width": "0px"})
3232
assert-css: ("h2#implementations", {"font-size": "22px"})
3333
assert-css: ("h2#implementations", {"border-bottom-width": "1px"})
3434

35-
assert-css: ("#impl > h3.code-header", {"font-size": "18px"})
36-
assert-css: ("#impl > h3.code-header", {"border-bottom-width": "0px"})
35+
assert-css: ("#impl-HeavilyDocumentedStruct > h3.code-header", {"font-size": "18px"})
36+
assert-css: ("#impl-HeavilyDocumentedStruct > h3.code-header", {"border-bottom-width": "0px"})
3737
assert-css: ("#method\.do_nothing > h4.code-header", {"font-size": "16px"})
3838
assert-css: ("#method\.do_nothing > h4.code-header", {"border-bottom-width": "0px"})
3939

@@ -87,8 +87,8 @@ assert-css: ("h6#structy-prose-sub-heading", {"border-bottom-width": "0px"})
8787
assert-css: ("h2#implementations", {"font-size": "22px"})
8888
assert-css: ("h2#implementations", {"border-bottom-width": "1px"})
8989

90-
assert-css: ("#impl > h3.code-header", {"font-size": "18px"})
91-
assert-css: ("#impl > h3.code-header", {"border-bottom-width": "0px"})
90+
assert-css: ("#impl-HeavilyDocumentedEnum > h3.code-header", {"font-size": "18px"})
91+
assert-css: ("#impl-HeavilyDocumentedEnum > h3.code-header", {"border-bottom-width": "0px"})
9292
assert-css: ("#method\.do_nothing > h4.code-header", {"font-size": "16px"})
9393
assert-css: ("#method\.do_nothing > h4.code-header", {"border-bottom-width": "0px"})
9494

@@ -129,8 +129,8 @@ assert-css: ("h4#sub-heading-for-union-variant", {"border-bottom-width": "0px"})
129129
assert-css: ("h2#implementations", {"font-size": "22px"})
130130
assert-css: ("h2#implementations", {"border-bottom-width": "1px"})
131131

132-
assert-css: ("#impl > h3.code-header", {"font-size": "18px"})
133-
assert-css: ("#impl > h3.code-header", {"border-bottom-width": "0px"})
132+
assert-css: ("#impl-HeavilyDocumentedUnion > h3.code-header", {"font-size": "18px"})
133+
assert-css: ("#impl-HeavilyDocumentedUnion > h3.code-header", {"border-bottom-width": "0px"})
134134
assert-css: ("h4#title-for-union-impl-doc", {"font-size": "16px"})
135135
assert-css: ("h4#title-for-union-impl-doc", {"border-bottom-width": "0px"})
136136
assert-css: ("h5#sub-heading-for-union-impl-doc", {"font-size": "16px"})

src/test/rustdoc-gui/implementors.goml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ assert: "#implementors-list"
66
assert-count: ("#implementors-list .impl", 2)
77
// Now we check that both implementors have an anchor, an ID and a similar DOM.
88
assert: ("#implementors-list .impl:nth-child(1) > a.anchor")
9-
assert-attribute: ("#implementors-list .impl:nth-child(1)", {"id": "impl-Whatever"})
10-
assert-attribute: ("#implementors-list .impl:nth-child(1) > a.anchor", {"href": "#impl-Whatever"})
9+
assert-attribute: ("#implementors-list .impl:nth-child(1)", {"id": "impl-Whatever-for-Struct"})
10+
assert-attribute: ("#implementors-list .impl:nth-child(1) > a.anchor", {"href": "#impl-Whatever-for-Struct"})
1111
assert: "#implementors-list .impl:nth-child(1) > .code-header.in-band"
1212

1313
assert: ("#implementors-list .impl:nth-child(2) > a.anchor")

src/test/rustdoc-gui/toggle-click-deadspace.goml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ click: ".impl-items .rustdoc-toggle summary::before" // This is the position of
88
assert-attribute-false: (".impl-items .rustdoc-toggle", {"open": ""})
99

1010
// Click the "Trait" part of "impl Trait" and verify it navigates.
11-
click: "#impl-Trait h3 a:first-of-type"
11+
click: "#impl-Trait-for-Foo h3 a:first-of-type"
1212
assert-text: (".fqn .in-band", "Trait lib2::Trait")

src/test/rustdoc/blanket-reexport-item.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![crate_name = "foo"]
22

3-
// @has foo/struct.S.html '//*[@id="impl-Into%3CU%3E"]//h3[@class="code-header in-band"]' 'impl<T, U> Into<U> for T'
3+
// @has foo/struct.S.html '//*[@id="impl-Into%3CU%3E-for-S"]//h3[@class="code-header in-band"]' 'impl<T, U> Into<U> for T'
44
pub struct S2 {}
55
mod m {
66
pub struct S {}

src/test/rustdoc/const-generics/const-generics-docs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub struct Foo<const N: usize> where u8: Trait<N>;
3636
// @has foo/struct.Bar.html '//pre[@class="rust struct"]' 'pub struct Bar<T, const N: usize>(_)'
3737
pub struct Bar<T, const N: usize>([T; N]);
3838

39-
// @has foo/struct.Foo.html '//*[@id="impl"]/h3[@class="code-header in-band"]' 'impl<const M: usize> Foo<M> where u8: Trait<M>'
39+
// @has foo/struct.Foo.html '//*[@id="impl-Foo%3CM%3E"]/h3[@class="code-header in-band"]' 'impl<const M: usize> Foo<M> where u8: Trait<M>'
4040
impl<const M: usize> Foo<M> where u8: Trait<M> {
4141
// @has - '//*[@id="associatedconstant.FOO_ASSOC"]' 'pub const FOO_ASSOC: usize'
4242
pub const FOO_ASSOC: usize = M + 13;
@@ -47,7 +47,7 @@ impl<const M: usize> Foo<M> where u8: Trait<M> {
4747
}
4848
}
4949

50-
// @has foo/struct.Bar.html '//*[@id="impl"]/h3[@class="code-header in-band"]' 'impl<const M: usize> Bar<u8, M>'
50+
// @has foo/struct.Bar.html '//*[@id="impl-Bar%3Cu8%2C%20M%3E"]/h3[@class="code-header in-band"]' 'impl<const M: usize> Bar<u8, M>'
5151
impl<const M: usize> Bar<u8, M> {
5252
// @has - '//*[@id="method.hey"]' \
5353
// 'pub fn hey<const N: usize>(&self) -> Foo<N> where u8: Trait<N>'

src/test/rustdoc/const-generics/const-impl.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@ pub enum Order {
99
}
1010

1111
// @has foo/struct.VSet.html '//pre[@class="rust struct"]' 'pub struct VSet<T, const ORDER: Order>'
12-
// @has foo/struct.VSet.html '//*[@id="impl-Send"]/h3[@class="code-header in-band"]' 'impl<T, const ORDER: Order> Send for VSet<T, ORDER>'
13-
// @has foo/struct.VSet.html '//*[@id="impl-Sync"]/h3[@class="code-header in-band"]' 'impl<T, const ORDER: Order> Sync for VSet<T, ORDER>'
12+
// @has foo/struct.VSet.html '//*[@id="impl-Send-for-VSet%3CT%2C%20ORDER%3E"]/h3[@class="code-header in-band"]' 'impl<T, const ORDER: Order> Send for VSet<T, ORDER>'
13+
// @has foo/struct.VSet.html '//*[@id="impl-Sync-for-VSet%3CT%2C%20ORDER%3E"]/h3[@class="code-header in-band"]' 'impl<T, const ORDER: Order> Sync for VSet<T, ORDER>'
1414
pub struct VSet<T, const ORDER: Order> {
1515
inner: Vec<T>,
1616
}
1717

18-
// @has foo/struct.VSet.html '//*[@id="impl"]/h3[@class="code-header in-band"]' 'impl<T> VSet<T, { Order::Sorted }>'
18+
// @has foo/struct.VSet.html '//*[@id="impl-VSet%3CT%2C%20{%20Order%3A%3ASorted%20}%3E"]/h3[@class="code-header in-band"]' 'impl<T> VSet<T, { Order::Sorted }>'
1919
impl<T> VSet<T, { Order::Sorted }> {
2020
pub fn new() -> Self {
2121
Self { inner: Vec::new() }
2222
}
2323
}
2424

25-
// @has foo/struct.VSet.html '//*[@id="impl-1"]/h3[@class="code-header in-band"]' 'impl<T> VSet<T, { Order::Unsorted }>'
25+
// @has foo/struct.VSet.html '//*[@id="impl-VSet%3CT%2C%20{%20Order%3A%3AUnsorted%20}%3E"]/h3[@class="code-header in-band"]' 'impl<T> VSet<T, { Order::Unsorted }>'
2626
impl<T> VSet<T, { Order::Unsorted }> {
2727
pub fn new() -> Self {
2828
Self { inner: Vec::new() }
@@ -31,7 +31,7 @@ impl<T> VSet<T, { Order::Unsorted }> {
3131

3232
pub struct Escape<const S: &'static str>;
3333

34-
// @has foo/struct.Escape.html '//*[@id="impl"]/h3[@class="code-header in-band"]' 'impl Escape<r#"<script>alert("Escape");</script>"#>'
34+
// @has foo/struct.Escape.html '//*[@id="impl-Escape%3Cr#%22%3Cscript%3Ealert(%22Escape%22)%3B%3C/script%3E%22#%3E"]/h3[@class="code-header in-band"]' 'impl Escape<r#"<script>alert("Escape");</script>"#>'
3535
impl Escape<r#"<script>alert("Escape");</script>"#> {
3636
pub fn f() {}
3737
}

src/test/rustdoc/empty-impls.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
#![crate_name = "foo"]
22

33
// @has foo/struct.Foo.html
4-
// @has - '//div[@id="synthetic-implementations-list"]/*[@id="impl-Send"]' 'impl Send for Foo'
4+
// @has - '//div[@id="synthetic-implementations-list"]/*[@id="impl-Send-for-Foo"]' 'impl Send for Foo'
55
pub struct Foo;
66

77
pub trait EmptyTrait {}
88

9-
// @has - '//div[@id="trait-implementations-list"]/*[@id="impl-EmptyTrait"]' 'impl EmptyTrait for Foo'
9+
// @has - '//div[@id="trait-implementations-list"]/*[@id="impl-EmptyTrait-for-Foo"]' 'impl EmptyTrait for Foo'
1010
impl EmptyTrait for Foo {}
1111

1212
pub trait NotEmpty {
1313
fn foo(&self);
1414
}
1515

16-
// @has - '//div[@id="trait-implementations-list"]/details/summary/*[@id="impl-NotEmpty"]' 'impl NotEmpty for Foo'
16+
// @has - '//div[@id="trait-implementations-list"]/details/summary/*[@id="impl-NotEmpty-for-Foo"]' 'impl NotEmpty for Foo'
1717
impl NotEmpty for Foo {
1818
fn foo(&self) {}
1919
}

src/test/rustdoc/generic-impl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
use std::fmt;
44

5-
// @!has foo/struct.Bar.html '//*[@id="impl-ToString"]//h3[@class="code-header in-band"]' 'impl<T> ToString for T'
5+
// @!has foo/struct.Bar.html '//*[@id="impl-ToString-for-Bar"]//h3[@class="code-header in-band"]' 'impl<T> ToString for T'
66
pub struct Bar;
77

8-
// @has foo/struct.Foo.html '//*[@id="impl-ToString"]//h3[@class="code-header in-band"]' 'impl<T> ToString for T'
8+
// @has foo/struct.Foo.html '//*[@id="impl-ToString-for-Foo"]//h3[@class="code-header in-band"]' 'impl<T> ToString for T'
99
pub struct Foo;
1010
// @has foo/struct.Foo.html '//*[@class="sidebar-elems"]//section//a[@href="#impl-ToString"]' 'ToString'
1111

src/test/rustdoc/hidden-trait-struct-impls.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ pub struct Bar;
1111

1212
struct Hidden;
1313

14-
// @!has foo/struct.Bar.html '//*[@id="impl-Foo"]' 'impl Foo for Bar'
14+
// @!has foo/struct.Bar.html '//*[@id="impl-Foo-for-Bar"]' 'impl Foo for Bar'
1515
impl Foo for Bar {}
16-
// @!has foo/struct.Bar.html '//*[@id="impl-Dark"]' 'impl Dark for Bar'
16+
// @!has foo/struct.Bar.html '//*[@id="impl-Dark-for-Bar"]' 'impl Dark for Bar'
1717
impl Dark for Bar {}
18-
// @has foo/struct.Bar.html '//*[@id="impl-Bam"]' 'impl Bam for Bar'
18+
// @has foo/struct.Bar.html '//*[@id="impl-Bam-for-Bar"]' 'impl Bam for Bar'
1919
// @has foo/trait.Bam.html '//*[@id="implementors-list"]' 'impl Bam for Bar'
2020
impl Bam for Bar {}
2121
// @!has foo/trait.Bam.html '//*[@id="implementors-list"]' 'impl Bam for Hidden'

src/test/rustdoc/issue-29503.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pub trait MyTrait {
55
fn my_string(&self) -> String;
66
}
77

8-
// @has - "//div[@id='implementors-list']//*[@id='impl-MyTrait']//h3[@class='code-header in-band']" "impl<T> MyTrait for T where T: Debug"
8+
// @has - "//div[@id='implementors-list']//*[@id='impl-MyTrait-for-T']//h3[@class='code-header in-band']" "impl<T> MyTrait for T where T: Debug"
99
impl<T> MyTrait for T
1010
where
1111
T: fmt::Debug,

src/test/rustdoc/primitive/primitive-generic-impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![feature(rustdoc_internals)]
22
#![crate_name = "foo"]
33

4-
// @has foo/primitive.i32.html '//*[@id="impl-ToString"]//h3[@class="code-header in-band"]' 'impl<T> ToString for T'
4+
// @has foo/primitive.i32.html '//*[@id="impl-ToString-for-i32"]//h3[@class="code-header in-band"]' 'impl<T> ToString for T'
55

66
#[doc(primitive = "i32")]
77
/// Some useless docs, wouhou!

src/test/rustdoc/sized_trait.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub struct Bar {
1111
pub struct Foo<T: ?Sized>(T);
1212

1313
// @has foo/struct.Unsized.html
14-
// @has - '//*[@id="impl-Sized"]//h3[@class="code-header in-band"]' 'impl !Sized for Unsized'
14+
// @has - '//*[@id="impl-Sized-for-Unsized"]//h3[@class="code-header in-band"]' 'impl !Sized for Unsized'
1515
pub struct Unsized {
1616
data: [u8],
1717
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#![crate_name = "foo"]
22

33
// @has foo/struct.Unsized.html
4-
// @has - '//*[@id="impl-Sized"]/h3[@class="code-header in-band"]' 'impl !Sized for Unsized'
4+
// @has - '//div[@id="impl-Sized-for-Unsized"]/h3[@class="code-header in-band"]' 'impl !Sized for Unsized'
55
// @!has - '//*[@id="impl-Sized"]//a[@class="srclink"]' 'source'
6-
// @has - '//*[@id="impl-Sync"]/h3[@class="code-header in-band"]' 'impl Sync for Unsized'
6+
// @has - '//*[@id="impl-Sync-for-Unsized"]/h3[@class="code-header in-band"]' 'impl Sync for Unsized'
77
// @!has - '//*[@id="impl-Sync"]//a[@class="srclink"]' 'source'
8-
// @has - '//*[@id="impl-Any"]/h3[@class="code-header in-band"]' 'impl<T> Any for T'
9-
// @has - '//*[@id="impl-Any"]//a[@class="srclink"]' 'source'
8+
// @has - '//*[@id="impl-Any-for-Unsized"]/h3[@class="code-header in-band"]' 'impl<T> Any for T'
9+
// @has - '//*[@id="impl-Any-for-Unsized"]//a[@class="srclink"]' 'source'
1010
pub struct Unsized {
1111
data: [u8],
1212
}

src/test/rustdoc/trait-impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,5 @@ impl Trait for Struct {
4343
// @!has - '//*[@id="method.d"]/../../div[@class="docblock"]/p/em'
4444
fn d() {}
4545

46-
// @has - '//*[@id="impl-Trait"]/h3//a/@href' 'trait.Trait.html'
46+
// @has - '//*[@id="impl-Trait-for-Struct"]/h3//a/@href' 'trait.Trait.html'
4747
}

0 commit comments

Comments
 (0)