Skip to content

Commit 3583e86

Browse files
committed
rustdoc: update test cases for changes to the printing style
This whole thing changes it so that the JS and the UI both use rustc's own path printing to handle the impl IDs. This results in the format changing a little bit; full paths are used in spots where they aren't strictly necessary, and the path sometimes uses generics where the old system used the trait's own name, but it shouldn't matter since the orphan rules will prevent it anyway.
1 parent 3fbfe2b commit 3583e86

9 files changed

+42
-31
lines changed

tests/rustdoc-js-std/simd-type-signatures.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,59 +11,59 @@ const EXPECTED = [
1111
'query': 'simd<i16>, simd<i16> -> simd<i16>',
1212
'others': [
1313
{
14-
'path': 'std::simd::Simd',
14+
'path': 'std::simd::prelude::Simd',
1515
'name': 'simd_max',
16-
'href': '../std/simd/struct.Simd.html#impl-core::simd::SimdOrd-for-core::simd::Simd%3Ci16,+LANES%3E/method.simd_max'
16+
'href': '../std/simd/prelude/struct.Simd.html#impl-SimdOrd-for-Simd%3Ci16,+LANES%3E/method.simd_max'
1717
},
1818
{
19-
'path': 'std::simd::Simd',
19+
'path': 'std::simd::prelude::Simd',
2020
'name': 'simd_min',
21-
'href': '../std/simd/struct.Simd.html#impl-core::simd::SimdOrd-for-core::simd::Simd%3Ci16,+LANES%3E/method.simd_min'
21+
'href': '../std/simd/prelude/struct.Simd.html#impl-SimdOrd-for-Simd%3Ci16,+LANES%3E/method.simd_min'
2222
},
2323
{
24-
'path': 'std::simd::Simd',
24+
'path': 'std::simd::prelude::Simd',
2525
'name': 'simd_clamp',
26-
'href': '../std/simd/struct.Simd.html#impl-core::simd::SimdOrd-for-core::simd::Simd%3Ci16,+LANES%3E/method.simd_clamp'
26+
'href': '../std/simd/prelude/struct.Simd.html#impl-SimdOrd-for-Simd%3Ci16,+LANES%3E/method.simd_clamp'
2727
},
2828
{
29-
'path': 'std::simd::Simd',
29+
'path': 'std::simd::prelude::Simd',
3030
'name': 'saturating_add',
31-
'href': '../std/simd/struct.Simd.html#impl-core::simd::SimdInt-for-core::simd::Simd%3Ci16,+LANES%3E/method.saturating_add'
31+
'href': '../std/simd/prelude/struct.Simd.html#impl-SimdInt-for-Simd%3Ci16,+LANES%3E/method.saturating_add'
3232
},
3333
{
34-
'path': 'std::simd::Simd',
34+
'path': 'std::simd::prelude::Simd',
3535
'name': 'saturating_sub',
36-
'href': '../std/simd/struct.Simd.html#impl-core::simd::SimdInt-for-core::simd::Simd%3Ci16,+LANES%3E/method.saturating_sub'
36+
'href': '../std/simd/prelude/struct.Simd.html#impl-SimdInt-for-Simd%3Ci16,+LANES%3E/method.saturating_sub'
3737
},
3838
],
3939
},
4040
{
4141
'query': 'simd<i8>, simd<i8> -> simd<i8>',
4242
'others': [
4343
{
44-
'path': 'std::simd::Simd',
44+
'path': 'std::simd::prelude::Simd',
4545
'name': 'simd_max',
46-
'href': '../std/simd/struct.Simd.html#impl-core::simd::SimdOrd-for-core::simd::Simd%3Ci8,+LANES%3E/method.simd_max'
46+
'href': '../std/simd/prelude/struct.Simd.html#impl-SimdOrd-for-Simd%3Ci8,+LANES%3E/method.simd_max'
4747
},
4848
{
49-
'path': 'std::simd::Simd',
49+
'path': 'std::simd::prelude::Simd',
5050
'name': 'simd_min',
51-
'href': '../std/simd/struct.Simd.html#impl-core::simd::SimdOrd-for-core::simd::Simd%3Ci8,+LANES%3E/method.simd_min'
51+
'href': '../std/simd/prelude/struct.Simd.html#impl-SimdOrd-for-Simd%3Ci8,+LANES%3E/method.simd_min'
5252
},
5353
{
54-
'path': 'std::simd::Simd',
54+
'path': 'std::simd::prelude::Simd',
5555
'name': 'simd_clamp',
56-
'href': '../std/simd/struct.Simd.html#impl-core::simd::SimdOrd-for-core::simd::Simd%3Ci8,+LANES%3E/method.simd_clamp'
56+
'href': '../std/simd/prelude/struct.Simd.html#impl-SimdOrd-for-Simd%3Ci8,+LANES%3E/method.simd_clamp'
5757
},
5858
{
59-
'path': 'std::simd::Simd',
59+
'path': 'std::simd::prelude::Simd',
6060
'name': 'saturating_add',
61-
'href': '../std/simd/struct.Simd.html#impl-core::simd::SimdInt-for-core::simd::Simd%3Ci8,+LANES%3E/method.saturating_add'
61+
'href': '../std/simd/prelude/struct.Simd.html#impl-SimdInt-for-Simd%3Ci8,+LANES%3E/method.saturating_add'
6262
},
6363
{
64-
'path': 'std::simd::Simd',
64+
'path': 'std::simd::prelude::Simd',
6565
'name': 'saturating_sub',
66-
'href': '../std/simd/struct.Simd.html#impl-core::simd::SimdInt-for-core::simd::Simd%3Ci8,+LANES%3E/method.saturating_sub'
66+
'href': '../std/simd/prelude/struct.Simd.html#impl-SimdInt-for-Simd%3Ci8,+LANES%3E/method.saturating_sub'
6767
},
6868
],
6969
},

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

tests/rustdoc/const-generics/const-impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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-Escape%3Cr%23%22%3Cscript%3Ealert(%22Escape%22);%3C/script%3E%22%23%3E"]/h3[@class="code-header"]' 'impl Escape<r#"<script>alert("Escape");</script>"#>'
34+
// @has foo/struct.Escape.html '//*[@id="impl-Escape%3C%22%3Cscript%3Ealert(%5C%22Escape%5C%22);%3C/script%3E%22%3E"]/h3[@class="code-header"]' 'impl Escape<r#"<script>alert("Escape");</script>"#>'
3535
impl Escape<r#"<script>alert("Escape");</script>"#> {
3636
pub fn f() {}
3737
}

tests/rustdoc/generic-impl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ use std::fmt;
55
// @!has foo/struct.Bar.html '//*[@id="impl-ToString-for-Bar"]' ''
66
pub struct Bar;
77

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

1212
impl fmt::Display for Foo {
1313
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {

tests/rustdoc/issue-78701.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
// @has 'foo/struct.AnotherStruct.html'
88
// @count - '//*[@class="sidebar"]//a[@href="#impl-AnAmazingTrait-for-AnotherStruct%3C()%3E"]' 1
9-
// @count - '//*[@class="sidebar"]//a[@href="#impl-AnAmazingTrait-for-AnotherStruct%3CT%3E"]' 1
9+
// @count - '//*[@class="sidebar"]//a[@href="#impl-AnAmazingTrait-for-T"]' 1
1010

1111
pub trait Something {}
1212

tests/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(rustc_attrs)]
22
#![crate_name = "foo"]
33

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

66
#[rustc_doc_primitive = "i32"]
77
/// Some useless docs, wouhou!

tests/rustdoc/sidebar-links-to-foreign-impl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
// @has - '//h2[@id="foreign-impls"]' 'Implementations on Foreign Types'
88
// @has - '//*[@class="sidebar-elems"]//section//a[@href="#impl-Foo-for-u32"]' 'u32'
99
// @has - '//*[@id="impl-Foo-for-u32"]//h3[@class="code-header"]' 'impl Foo for u32'
10-
// @has - "//*[@class=\"sidebar-elems\"]//section//a[@href=\"#impl-Foo-for-%26'a+str\"]" "&'a str"
11-
// @has - "//*[@id=\"impl-Foo-for-%26'a+str\"]//h3[@class=\"code-header\"]" "impl<'a> Foo for &'a str"
10+
// @has - "//*[@class=\"sidebar-elems\"]//section//a[@href=\"#impl-Foo-for-%26str\"]" "&'a str"
11+
// @has - "//*[@id=\"impl-Foo-for-%26str\"]//h3[@class=\"code-header\"]" "impl<'a> Foo for &'a str"
1212
pub trait Foo {}
1313

1414
impl Foo for u32 {}

tests/rustdoc/src-links-auto-impls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// @!has - '//*[@id="impl-Sized-for-Unsized"]//a[@class="src"]' 'source'
66
// @has - '//*[@id="impl-Sync-for-Unsized"]/h3[@class="code-header"]' 'impl Sync for Unsized'
77
// @!has - '//*[@id="impl-Sync-for-Unsized"]//a[@class="src"]' 'source'
8-
// @has - '//*[@id="impl-Any-for-Unsized"]/h3[@class="code-header"]' 'impl<T> Any for T'
9-
// @has - '//*[@id="impl-Any-for-Unsized"]//a[@class="src rightside"]' 'source'
8+
// @has - '//*[@id="impl-Any-for-T"]/h3[@class="code-header"]' 'impl<T> Any for T'
9+
// @has - '//*[@id="impl-Any-for-T"]//a[@class="src rightside"]' 'source'
1010
pub struct Unsized {
1111
data: [u8],
1212
}

tests/rustdoc/where-clause-order.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ where
77
}
88

99
// @has 'foo/trait.SomeTrait.html'
10-
// @has - "//*[@id='impl-SomeTrait%3C(A,+B,+C,+D,+E)%3E-for-(A,+B,+C,+D,+E)']/h3" "impl<A, B, C, D, E> SomeTrait<(A, B, C, D, E)> for (A, B, C, D, E)where A: PartialOrd<A> + PartialEq<A>, B: PartialOrd<B> + PartialEq<B>, C: PartialOrd<C> + PartialEq<C>, D: PartialOrd<D> + PartialEq<D>, E: PartialOrd<E> + PartialEq<E> + ?Sized, "
10+
// @has - "//*[@id='impl-SomeTrait-for-(A,+B,+C,+D,+E)']/h3" "impl<A, B, C, D, E> SomeTrait<(A, B, C, D, E)> for (A, B, C, D, E)where A: PartialOrd<A> + PartialEq<A>, B: PartialOrd<B> + PartialEq<B>, C: PartialOrd<C> + PartialEq<C>, D: PartialOrd<D> + PartialEq<D>, E: PartialOrd<E> + PartialEq<E> + ?Sized, "
1111
impl<A, B, C, D, E> SomeTrait<(A, B, C, D, E)> for (A, B, C, D, E)
1212
where
1313
A: PartialOrd<A> + PartialEq<A>,
@@ -17,3 +17,14 @@ where
1717
E: PartialOrd<E> + PartialEq<E> + ?Sized,
1818
{
1919
}
20+
21+
// @has - "//*[@id='impl-SomeTrait%3C(A,+B,+C,+D)%3E-for-(A,+B,+C,+D,+E)']/h3" "impl<A, B, C, D, E> SomeTrait<(A, B, C, D)> for (A, B, C, D, E)where A: PartialOrd<A> + PartialEq<A>, B: PartialOrd<B> + PartialEq<B>, C: PartialOrd<C> + PartialEq<C>, D: PartialOrd<D> + PartialEq<D>, E: PartialOrd<E> + PartialEq<E> + ?Sized, "
22+
impl<A, B, C, D, E> SomeTrait<(A, B, C, D)> for (A, B, C, D, E)
23+
where
24+
A: PartialOrd<A> + PartialEq<A>,
25+
B: PartialOrd<B> + PartialEq<B>,
26+
C: PartialOrd<C> + PartialEq<C>,
27+
D: PartialOrd<D> + PartialEq<D>,
28+
E: PartialOrd<E> + PartialEq<E> + ?Sized,
29+
{
30+
}

0 commit comments

Comments
 (0)