Skip to content

Commit 083cf2a

Browse files
pierwillcamelid
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 498eeb7 commit 083cf2a

18 files changed

+49
-70
lines changed

src/librustdoc/html/render/mod.rs

+8-25
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,6 @@ fn render_impls(cx: &Context<'_>, w: &mut Buffer, impls: &[&&Impl], containing_i
719719
&[],
720720
ImplRenderingParameters {
721721
show_def_docs: true,
722-
is_on_foreign_type: false,
723722
show_default_items: true,
724723
show_non_assoc_items: true,
725724
toggle_open_by_default: true,
@@ -1104,7 +1103,6 @@ fn render_assoc_items_inner(
11041103
&[],
11051104
ImplRenderingParameters {
11061105
show_def_docs: true,
1107-
is_on_foreign_type: false,
11081106
show_default_items: true,
11091107
show_non_assoc_items: true,
11101108
toggle_open_by_default: true,
@@ -1308,7 +1306,6 @@ fn notable_traits_decl(decl: &clean::FnDecl, cx: &Context<'_>) -> String {
13081306
#[derive(Clone, Copy, Debug)]
13091307
struct ImplRenderingParameters {
13101308
show_def_docs: bool,
1311-
is_on_foreign_type: bool,
13121309
show_default_items: bool,
13131310
/// Whether or not to show methods.
13141311
show_non_assoc_items: bool,
@@ -1616,7 +1613,6 @@ fn render_impl(
16161613
parent,
16171614
rendering_params.show_def_docs,
16181615
use_absolute,
1619-
rendering_params.is_on_foreign_type,
16201616
aliases,
16211617
);
16221618
if toggled {
@@ -1693,21 +1689,12 @@ pub(crate) fn render_impl_summary(
16931689
containing_item: &clean::Item,
16941690
show_def_docs: bool,
16951691
use_absolute: Option<bool>,
1696-
is_on_foreign_type: bool,
16971692
// This argument is used to reference same type with different paths to avoid duplication
16981693
// in documentation pages for trait with automatic implementations like "Send" and "Sync".
16991694
aliases: &[String],
17001695
) {
1701-
let id = cx.derive_id(match i.inner_impl().trait_ {
1702-
Some(ref t) => {
1703-
if is_on_foreign_type {
1704-
get_id_for_impl_on_foreign_type(&i.inner_impl().for_, t, cx)
1705-
} else {
1706-
format!("impl-{}", small_url_encode(format!("{:#}", t.print(cx))))
1707-
}
1708-
}
1709-
None => "impl".to_string(),
1710-
});
1696+
let id =
1697+
cx.derive_id(get_id_for_impl(&i.inner_impl().for_, i.inner_impl().trait_.as_ref(), cx));
17111698
let aliases = if aliases.is_empty() {
17121699
String::new()
17131700
} else {
@@ -2198,12 +2185,11 @@ fn sidebar_struct(cx: &Context<'_>, buf: &mut Buffer, it: &clean::Item, s: &clea
21982185
}
21992186
}
22002187

2201-
fn get_id_for_impl_on_foreign_type(
2202-
for_: &clean::Type,
2203-
trait_: &clean::Path,
2204-
cx: &Context<'_>,
2205-
) -> String {
2206-
small_url_encode(format!("impl-{:#}-for-{:#}", trait_.print(cx), for_.print(cx)))
2188+
fn get_id_for_impl(for_: &clean::Type, trait_: Option<&clean::Path>, cx: &Context<'_>) -> String {
2189+
match trait_ {
2190+
Some(t) => small_url_encode(format!("impl-{:#}-for-{:#}", t.print(cx), for_.print(cx))),
2191+
None => small_url_encode(format!("impl-{:#}", for_.print(cx))),
2192+
}
22072193
}
22082194

22092195
fn extract_for_impl_name(item: &clean::Item, cx: &Context<'_>) -> Option<(String, String)> {
@@ -2212,10 +2198,7 @@ fn extract_for_impl_name(item: &clean::Item, cx: &Context<'_>) -> Option<(String
22122198
i.trait_.as_ref().map(|trait_| {
22132199
// Alternative format produces no URLs,
22142200
// so this parameter does nothing.
2215-
(
2216-
format!("{:#}", i.for_.print(cx)),
2217-
get_id_for_impl_on_foreign_type(&i.for_, trait_, cx),
2218-
)
2201+
(format!("{:#}", i.for_.print(cx)), get_id_for_impl(&i.for_, Some(trait_), cx))
22192202
})
22202203
}
22212204
_ => None,

src/librustdoc/html/render/print_item.rs

-2
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,6 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
800800
&[],
801801
ImplRenderingParameters {
802802
show_def_docs: false,
803-
is_on_foreign_type: true,
804803
show_default_items: false,
805804
show_non_assoc_items: true,
806805
toggle_open_by_default: false,
@@ -1509,7 +1508,6 @@ fn render_implementor(
15091508
aliases,
15101509
ImplRenderingParameters {
15111510
show_def_docs: false,
1512-
is_on_foreign_type: false,
15131511
show_default_items: false,
15141512
show_non_assoc_items: false,
15151513
toggle_open_by_default: false,

src/test/rustdoc-gui/anchors.goml

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ 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
// Now we check the positions: only the first heading of the top doc comment should
3535
// have a different position.

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

+6-6
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

@@ -61,9 +61,9 @@ assert-css: (
6161
ALL,
6262
)
6363

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

@@ -97,8 +97,8 @@ assert-css: (
9797
ALL,
9898
)
9999

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

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

src/test/rustdoc-gui/headings.goml

+6-6
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ assert-css: ("h4#sub-heading-for-field", {"border-bottom-width": "0px"})
3333
assert-css: ("h2#implementations", {"font-size": "22.4px"})
3434
assert-css: ("h2#implementations", {"border-bottom-width": "1px"})
3535

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

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

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

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

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

src/test/rustdoc-gui/implementors.goml

+2-2
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

+1-1
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![crate_name = "foo"]
22

3-
// @has foo/struct.S.html '//div[@id="impl-Into%3CU%3E"]//h3[@class="code-header in-band"]' 'impl<T, U> Into<U> for T'
3+
// @has foo/struct.S.html '//div[@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

+2-2
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 '//div[@id="impl"]/h3[@class="code-header in-band"]' 'impl<const M: usize> Foo<M> where u8: Trait<M>'
39+
// @has foo/struct.Foo.html '//div[@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 '//div[@id="impl"]/h3[@class="code-header in-band"]' 'impl<const M: usize> Bar<u8, M>'
50+
// @has foo/struct.Bar.html '//div[@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>'
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#![allow(incomplete_features)]
2-
32
#![feature(adt_const_params)]
4-
53
#![crate_name = "foo"]
64

75
#[derive(PartialEq, Eq)]
@@ -11,20 +9,20 @@ pub enum Order {
119
}
1210

1311
// @has foo/struct.VSet.html '//pre[@class="rust struct"]' 'pub struct VSet<T, const ORDER: Order>'
14-
// @has foo/struct.VSet.html '//div[@id="impl-Send"]/h3[@class="code-header in-band"]' 'impl<T, const ORDER: Order> Send for VSet<T, ORDER>'
15-
// @has foo/struct.VSet.html '//div[@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 '//div[@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 '//div[@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>'
1614
pub struct VSet<T, const ORDER: Order> {
1715
inner: Vec<T>,
1816
}
1917

20-
// @has foo/struct.VSet.html '//div[@id="impl"]/h3[@class="code-header in-band"]' 'impl<T> VSet<T, { Order::Sorted }>'
18+
// @has foo/struct.VSet.html '//div[@id="impl-VSet%3CT%2C%20{%20Order%3A%3ASorted%20}%3E"]/h3[@class="code-header in-band"]' 'impl<T> VSet<T, { Order::Sorted }>'
2119
impl<T> VSet<T, { Order::Sorted }> {
2220
pub fn new() -> Self {
2321
Self { inner: Vec::new() }
2422
}
2523
}
2624

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

3432
pub struct Escape<const S: &'static str>;
3533

36-
// @has foo/struct.Escape.html '//div[@id="impl"]/h3[@class="code-header in-band"]' 'impl Escape<r#"<script>alert("Escape");</script>"#>'
34+
// @has foo/struct.Escape.html '//div[@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>"#>'
3735
impl Escape<r#"<script>alert("Escape");</script>"#> {
3836
pub fn f() {}
3937
}

src/test/rustdoc/empty-impls.rs

+3-3
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"]/div[@id="impl-Send"]' 'impl Send for Foo'
4+
// @has - '//div[@id="synthetic-implementations-list"]/div[@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"]/div[@id="impl-EmptyTrait"]' 'impl EmptyTrait for Foo'
9+
// @has - '//div[@id="trait-implementations-list"]/div[@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/div[@id="impl-NotEmpty"]' 'impl NotEmpty for Foo'
16+
// @has - '//div[@id="trait-implementations-list"]/details/summary/div[@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

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
use std::fmt;
44

5-
// @!has foo/struct.Bar.html '//div[@id="impl-ToString"]//h3[@class="code-header in-band"]' 'impl<T> ToString for T'
5+
// @!has foo/struct.Bar.html '//div[@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 '//div[@id="impl-ToString"]//h3[@class="code-header in-band"]' 'impl<T> ToString for T'
8+
// @has foo/struct.Foo.html '//div[@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 '//div[@class="sidebar-links"]/a[@href="#impl-ToString"]' 'ToString'
1111

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

+3-3
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

+1-1
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']//div[@id='impl-MyTrait']//h3[@class='code-header in-band']" "impl<T> MyTrait for T where T: Debug"
8+
// @has - "//div[@id='implementors-list']//div[@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 where T: fmt::Debug {
1010
fn my_string(&self) -> String {
1111
format!("{:?}", self)

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#![crate_name = "foo"]
44

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

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

src/test/rustdoc/sized_trait.rs

+1-1
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 - '//div[@id="impl-Sized"]//h3[@class="code-header in-band"]' 'impl !Sized for Unsized'
14+
// @has - '//div[@id="impl-Sized-for-Unsized"]//h3[@class="code-header in-band"]' 'impl !Sized for Unsized'
1515
pub struct Unsized {
1616
data: [u8],
1717
}
+4-4
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 - '//div[@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 - '//div[@id="impl-Sized"]//a[@class="srclink"]' 'source'
6-
// @has - '//div[@id="impl-Sync"]/h3[@class="code-header in-band"]' 'impl Sync for Unsized'
6+
// @has - '//div[@id="impl-Sync-for-Unsized"]/h3[@class="code-header in-band"]' 'impl Sync for Unsized'
77
// @!has - '//div[@id="impl-Sync"]//a[@class="srclink"]' 'source'
8-
// @has - '//div[@id="impl-Any"]/h3[@class="code-header in-band"]' 'impl<T> Any for T'
9-
// @has - '//div[@id="impl-Any"]//a[@class="srclink"]' 'source'
8+
// @has - '//div[@id="impl-Any-for-Unsized"]/h3[@class="code-header in-band"]' 'impl<T> Any for T'
9+
// @has - '//div[@id="impl-Any-for-Unsized"]//a[@class="srclink"]' 'source'
1010
pub struct Unsized {
1111
data: [u8],
1212
}

src/test/rustdoc/trait-impl.rs

+1-1
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)