From b374996ab8d3d8a10fdf1ffcf2b1c3de3fdbbf64 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 5 May 2025 15:50:06 +0200 Subject: Created `tests/rustdoc/anchors` subfolder to limit number of files at the top level --- .../anchor-id-duplicate-method-name-25001.rs | 46 --------------- tests/rustdoc/anchor-id-trait-method-15169.rs | 7 --- tests/rustdoc/anchor-id-trait-tymethod-28478.rs | 34 ----------- tests/rustdoc/anchors.no_const_anchor.html | 1 - tests/rustdoc/anchors.no_const_anchor2.html | 1 - tests/rustdoc/anchors.no_method_anchor.html | 1 - tests/rustdoc/anchors.no_trait_method_anchor.html | 1 - tests/rustdoc/anchors.no_tymethod_anchor.html | 1 - tests/rustdoc/anchors.no_type_anchor.html | 1 - tests/rustdoc/anchors.no_type_anchor2.html | 1 - tests/rustdoc/anchors.rs | 49 ---------------- .../anchor-id-duplicate-method-name-25001.rs | 46 +++++++++++++++ .../anchors/anchor-id-trait-method-15169.rs | 7 +++ .../anchors/anchor-id-trait-tymethod-28478.rs | 34 +++++++++++ tests/rustdoc/anchors/anchors.no_const_anchor.html | 1 + .../rustdoc/anchors/anchors.no_const_anchor2.html | 1 + .../rustdoc/anchors/anchors.no_method_anchor.html | 1 + .../anchors/anchors.no_trait_method_anchor.html | 1 + .../anchors/anchors.no_tymethod_anchor.html | 1 + tests/rustdoc/anchors/anchors.no_type_anchor.html | 1 + tests/rustdoc/anchors/anchors.no_type_anchor2.html | 1 + tests/rustdoc/anchors/anchors.rs | 49 ++++++++++++++++ tests/rustdoc/anchors/auxiliary/issue-86620-1.rs | 11 ++++ .../rustdoc/anchors/disambiguate-anchors-32890.rs | 20 +++++++ .../anchors/disambiguate-anchors-header-29449.rs | 28 ++++++++++ .../extern-default-method.no_href_on_anchor.html | 1 + .../anchors/method-anchor-in-blanket-impl-86620.rs | 11 ++++ .../anchors/trait-impl-items-links-and-anchors.rs | 65 ++++++++++++++++++++++ tests/rustdoc/auxiliary/issue-86620-1.rs | 11 ---- tests/rustdoc/disambiguate-anchors-32890.rs | 20 ------- tests/rustdoc/disambiguate-anchors-header-29449.rs | 28 ---------- .../extern-default-method.no_href_on_anchor.html | 1 - .../rustdoc/method-anchor-in-blanket-impl-86620.rs | 11 ---- .../rustdoc/trait-impl-items-links-and-anchors.rs | 65 ---------------------- 34 files changed, 279 insertions(+), 279 deletions(-) delete mode 100644 tests/rustdoc/anchor-id-duplicate-method-name-25001.rs delete mode 100644 tests/rustdoc/anchor-id-trait-method-15169.rs delete mode 100644 tests/rustdoc/anchor-id-trait-tymethod-28478.rs delete mode 100644 tests/rustdoc/anchors.no_const_anchor.html delete mode 100644 tests/rustdoc/anchors.no_const_anchor2.html delete mode 100644 tests/rustdoc/anchors.no_method_anchor.html delete mode 100644 tests/rustdoc/anchors.no_trait_method_anchor.html delete mode 100644 tests/rustdoc/anchors.no_tymethod_anchor.html delete mode 100644 tests/rustdoc/anchors.no_type_anchor.html delete mode 100644 tests/rustdoc/anchors.no_type_anchor2.html delete mode 100644 tests/rustdoc/anchors.rs create mode 100644 tests/rustdoc/anchors/anchor-id-duplicate-method-name-25001.rs create mode 100644 tests/rustdoc/anchors/anchor-id-trait-method-15169.rs create mode 100644 tests/rustdoc/anchors/anchor-id-trait-tymethod-28478.rs create mode 100644 tests/rustdoc/anchors/anchors.no_const_anchor.html create mode 100644 tests/rustdoc/anchors/anchors.no_const_anchor2.html create mode 100644 tests/rustdoc/anchors/anchors.no_method_anchor.html create mode 100644 tests/rustdoc/anchors/anchors.no_trait_method_anchor.html create mode 100644 tests/rustdoc/anchors/anchors.no_tymethod_anchor.html create mode 100644 tests/rustdoc/anchors/anchors.no_type_anchor.html create mode 100644 tests/rustdoc/anchors/anchors.no_type_anchor2.html create mode 100644 tests/rustdoc/anchors/anchors.rs create mode 100644 tests/rustdoc/anchors/auxiliary/issue-86620-1.rs create mode 100644 tests/rustdoc/anchors/disambiguate-anchors-32890.rs create mode 100644 tests/rustdoc/anchors/disambiguate-anchors-header-29449.rs create mode 100644 tests/rustdoc/anchors/extern-default-method.no_href_on_anchor.html create mode 100644 tests/rustdoc/anchors/method-anchor-in-blanket-impl-86620.rs create mode 100644 tests/rustdoc/anchors/trait-impl-items-links-and-anchors.rs delete mode 100644 tests/rustdoc/auxiliary/issue-86620-1.rs delete mode 100644 tests/rustdoc/disambiguate-anchors-32890.rs delete mode 100644 tests/rustdoc/disambiguate-anchors-header-29449.rs delete mode 100644 tests/rustdoc/extern-default-method.no_href_on_anchor.html delete mode 100644 tests/rustdoc/method-anchor-in-blanket-impl-86620.rs delete mode 100644 tests/rustdoc/trait-impl-items-links-and-anchors.rs (limited to 'tests/rustdoc') diff --git a/tests/rustdoc/anchor-id-duplicate-method-name-25001.rs b/tests/rustdoc/anchor-id-duplicate-method-name-25001.rs deleted file mode 100644 index d7f4e587d5e..00000000000 --- a/tests/rustdoc/anchor-id-duplicate-method-name-25001.rs +++ /dev/null @@ -1,46 +0,0 @@ -// https://github.com/rust-lang/rust/issues/25001 -#![crate_name="issue_25001"] - -//@ has issue_25001/struct.Foo.html -pub struct Foo(T); - -pub trait Bar { - type Item; - - fn quux(self); -} - -impl Foo { - //@ has - '//*[@id="method.pass"]//h4[@class="code-header"]' 'fn pass()' - pub fn pass() {} -} -impl Foo { - //@ has - '//*[@id="method.pass-1"]//h4[@class="code-header"]' 'fn pass() -> usize' - pub fn pass() -> usize { 42 } -} -impl Foo { - //@ has - '//*[@id="method.pass-2"]//h4[@class="code-header"]' 'fn pass() -> isize' - pub fn pass() -> isize { 42 } -} - -impl Bar for Foo { - //@ has - '//*[@id="associatedtype.Item"]//h4[@class="code-header"]' 'type Item = T' - type Item=T; - - //@ has - '//*[@id="method.quux"]//h4[@class="code-header"]' 'fn quux(self)' - fn quux(self) {} -} -impl<'a, T> Bar for &'a Foo { - //@ has - '//*[@id="associatedtype.Item-1"]//h4[@class="code-header"]' "type Item = &'a T" - type Item=&'a T; - - //@ has - '//*[@id="method.quux-1"]//h4[@class="code-header"]' 'fn quux(self)' - fn quux(self) {} -} -impl<'a, T> Bar for &'a mut Foo { - //@ has - '//*[@id="associatedtype.Item-2"]//h4[@class="code-header"]' "type Item = &'a mut T" - type Item=&'a mut T; - - //@ has - '//*[@id="method.quux-2"]//h4[@class="code-header"]' 'fn quux(self)' - fn quux(self) {} -} diff --git a/tests/rustdoc/anchor-id-trait-method-15169.rs b/tests/rustdoc/anchor-id-trait-method-15169.rs deleted file mode 100644 index 19eeeaee9d1..00000000000 --- a/tests/rustdoc/anchor-id-trait-method-15169.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@ has issue_15169/struct.Foo.html '//*[@id="method.eq"]' 'fn eq' - -// https://github.com/rust-lang/rust/issues/15169 -#![crate_name="issue_15169"] - -#[derive(PartialEq)] -pub struct Foo; diff --git a/tests/rustdoc/anchor-id-trait-tymethod-28478.rs b/tests/rustdoc/anchor-id-trait-tymethod-28478.rs deleted file mode 100644 index e7adba7d06e..00000000000 --- a/tests/rustdoc/anchor-id-trait-tymethod-28478.rs +++ /dev/null @@ -1,34 +0,0 @@ -// https://github.com/rust-lang/rust/issues/28478 -#![crate_name="issue_28478"] - -#![feature(associated_type_defaults)] - -//@ has issue_28478/trait.Bar.html -pub trait Bar { - //@ has - '//*[@id="associatedtype.Bar"]' 'type Bar = ()' - //@ has - '//*[@href="#associatedtype.Bar"]' 'Bar' - type Bar = (); - //@ has - '//*[@id="associatedconstant.Baz"]' 'const Baz: usize' - //@ has - '//*[@href="#associatedconstant.Baz"]' 'Baz' - const Baz: usize = 7; - //@ has - '//*[@id="tymethod.bar"]' 'fn bar' - fn bar(); - //@ has - '//*[@id="method.baz"]' 'fn baz' - fn baz() { } -} - -//@ has issue_28478/struct.Foo.html -pub struct Foo; - -impl Foo { - //@ has - '//*[@href="#method.foo"]' 'foo' - pub fn foo() {} -} - -impl Bar for Foo { - //@ has - '//*[@href="trait.Bar.html#associatedtype.Bar"]' 'Bar' - //@ has - '//*[@href="trait.Bar.html#associatedconstant.Baz"]' 'Baz' - //@ has - '//*[@href="trait.Bar.html#tymethod.bar"]' 'bar' - fn bar() {} - //@ has - '//*[@href="trait.Bar.html#method.baz"]' 'baz' -} diff --git a/tests/rustdoc/anchors.no_const_anchor.html b/tests/rustdoc/anchors.no_const_anchor.html deleted file mode 100644 index 07a7507fa2e..00000000000 --- a/tests/rustdoc/anchors.no_const_anchor.html +++ /dev/null @@ -1 +0,0 @@ -
Source

const YOLO: u32

\ No newline at end of file diff --git a/tests/rustdoc/anchors.no_const_anchor2.html b/tests/rustdoc/anchors.no_const_anchor2.html deleted file mode 100644 index 091dac3e4b2..00000000000 --- a/tests/rustdoc/anchors.no_const_anchor2.html +++ /dev/null @@ -1 +0,0 @@ -
Source

pub const X: i32 = 0i32

\ No newline at end of file diff --git a/tests/rustdoc/anchors.no_method_anchor.html b/tests/rustdoc/anchors.no_method_anchor.html deleted file mode 100644 index 89f9898624c..00000000000 --- a/tests/rustdoc/anchors.no_method_anchor.html +++ /dev/null @@ -1 +0,0 @@ -
Source

pub fn new() -> Self

\ No newline at end of file diff --git a/tests/rustdoc/anchors.no_trait_method_anchor.html b/tests/rustdoc/anchors.no_trait_method_anchor.html deleted file mode 100644 index 51656a3e58f..00000000000 --- a/tests/rustdoc/anchors.no_trait_method_anchor.html +++ /dev/null @@ -1 +0,0 @@ -
Source

fn bar()

\ No newline at end of file diff --git a/tests/rustdoc/anchors.no_tymethod_anchor.html b/tests/rustdoc/anchors.no_tymethod_anchor.html deleted file mode 100644 index 49ee624bdbc..00000000000 --- a/tests/rustdoc/anchors.no_tymethod_anchor.html +++ /dev/null @@ -1 +0,0 @@ -
Source

fn foo()

\ No newline at end of file diff --git a/tests/rustdoc/anchors.no_type_anchor.html b/tests/rustdoc/anchors.no_type_anchor.html deleted file mode 100644 index c5ac3c93818..00000000000 --- a/tests/rustdoc/anchors.no_type_anchor.html +++ /dev/null @@ -1 +0,0 @@ -
Source

type T

\ No newline at end of file diff --git a/tests/rustdoc/anchors.no_type_anchor2.html b/tests/rustdoc/anchors.no_type_anchor2.html deleted file mode 100644 index 14dd31d87b6..00000000000 --- a/tests/rustdoc/anchors.no_type_anchor2.html +++ /dev/null @@ -1 +0,0 @@ -
Source

pub type Y = u32

\ No newline at end of file diff --git a/tests/rustdoc/anchors.rs b/tests/rustdoc/anchors.rs deleted file mode 100644 index 255ef87351c..00000000000 --- a/tests/rustdoc/anchors.rs +++ /dev/null @@ -1,49 +0,0 @@ -// This test ensures that anchors are generated in the right places. - -#![feature(inherent_associated_types)] -#![allow(incomplete_features)] -#![crate_name = "foo"] - -pub struct Foo; - -//@ has 'foo/trait.Bar.html' -pub trait Bar { - // There should be no anchors here. - //@ snapshot no_type_anchor - '//*[@id="associatedtype.T"]' - type T; - // There should be no anchors here. - //@ snapshot no_const_anchor - '//*[@id="associatedconstant.YOLO"]' - const YOLO: u32; - - // There should be no anchors here. - //@ snapshot no_tymethod_anchor - '//*[@id="tymethod.foo"]' - fn foo(); - // There should be no anchors here. - //@ snapshot no_trait_method_anchor - '//*[@id="method.bar"]' - fn bar() {} -} - -//@ has 'foo/struct.Foo.html' -impl Bar for Foo { - //@ has - '//*[@id="associatedtype.T"]/a[@class="anchor"]' '' - type T = u32; - //@ has - '//*[@id="associatedconstant.YOLO"]/a[@class="anchor"]' '' - const YOLO: u32 = 0; - - //@ has - '//*[@id="method.foo"]/a[@class="anchor"]' '' - fn foo() {} - // Same check for provided "bar" method. - //@ has - '//*[@id="method.bar"]/a[@class="anchor"]' '' -} - -impl Foo { - //@ snapshot no_const_anchor2 - '//*[@id="associatedconstant.X"]' - // There should be no anchors here. - pub const X: i32 = 0; - //@ snapshot no_type_anchor2 - '//*[@id="associatedtype.Y"]' - // There should be no anchors here. - pub type Y = u32; - //@ snapshot no_method_anchor - '//*[@id="method.new"]' - // There should be no anchors here. - pub fn new() -> Self { Self } -} diff --git a/tests/rustdoc/anchors/anchor-id-duplicate-method-name-25001.rs b/tests/rustdoc/anchors/anchor-id-duplicate-method-name-25001.rs new file mode 100644 index 00000000000..d7f4e587d5e --- /dev/null +++ b/tests/rustdoc/anchors/anchor-id-duplicate-method-name-25001.rs @@ -0,0 +1,46 @@ +// https://github.com/rust-lang/rust/issues/25001 +#![crate_name="issue_25001"] + +//@ has issue_25001/struct.Foo.html +pub struct Foo(T); + +pub trait Bar { + type Item; + + fn quux(self); +} + +impl Foo { + //@ has - '//*[@id="method.pass"]//h4[@class="code-header"]' 'fn pass()' + pub fn pass() {} +} +impl Foo { + //@ has - '//*[@id="method.pass-1"]//h4[@class="code-header"]' 'fn pass() -> usize' + pub fn pass() -> usize { 42 } +} +impl Foo { + //@ has - '//*[@id="method.pass-2"]//h4[@class="code-header"]' 'fn pass() -> isize' + pub fn pass() -> isize { 42 } +} + +impl Bar for Foo { + //@ has - '//*[@id="associatedtype.Item"]//h4[@class="code-header"]' 'type Item = T' + type Item=T; + + //@ has - '//*[@id="method.quux"]//h4[@class="code-header"]' 'fn quux(self)' + fn quux(self) {} +} +impl<'a, T> Bar for &'a Foo { + //@ has - '//*[@id="associatedtype.Item-1"]//h4[@class="code-header"]' "type Item = &'a T" + type Item=&'a T; + + //@ has - '//*[@id="method.quux-1"]//h4[@class="code-header"]' 'fn quux(self)' + fn quux(self) {} +} +impl<'a, T> Bar for &'a mut Foo { + //@ has - '//*[@id="associatedtype.Item-2"]//h4[@class="code-header"]' "type Item = &'a mut T" + type Item=&'a mut T; + + //@ has - '//*[@id="method.quux-2"]//h4[@class="code-header"]' 'fn quux(self)' + fn quux(self) {} +} diff --git a/tests/rustdoc/anchors/anchor-id-trait-method-15169.rs b/tests/rustdoc/anchors/anchor-id-trait-method-15169.rs new file mode 100644 index 00000000000..19eeeaee9d1 --- /dev/null +++ b/tests/rustdoc/anchors/anchor-id-trait-method-15169.rs @@ -0,0 +1,7 @@ +//@ has issue_15169/struct.Foo.html '//*[@id="method.eq"]' 'fn eq' + +// https://github.com/rust-lang/rust/issues/15169 +#![crate_name="issue_15169"] + +#[derive(PartialEq)] +pub struct Foo; diff --git a/tests/rustdoc/anchors/anchor-id-trait-tymethod-28478.rs b/tests/rustdoc/anchors/anchor-id-trait-tymethod-28478.rs new file mode 100644 index 00000000000..e7adba7d06e --- /dev/null +++ b/tests/rustdoc/anchors/anchor-id-trait-tymethod-28478.rs @@ -0,0 +1,34 @@ +// https://github.com/rust-lang/rust/issues/28478 +#![crate_name="issue_28478"] + +#![feature(associated_type_defaults)] + +//@ has issue_28478/trait.Bar.html +pub trait Bar { + //@ has - '//*[@id="associatedtype.Bar"]' 'type Bar = ()' + //@ has - '//*[@href="#associatedtype.Bar"]' 'Bar' + type Bar = (); + //@ has - '//*[@id="associatedconstant.Baz"]' 'const Baz: usize' + //@ has - '//*[@href="#associatedconstant.Baz"]' 'Baz' + const Baz: usize = 7; + //@ has - '//*[@id="tymethod.bar"]' 'fn bar' + fn bar(); + //@ has - '//*[@id="method.baz"]' 'fn baz' + fn baz() { } +} + +//@ has issue_28478/struct.Foo.html +pub struct Foo; + +impl Foo { + //@ has - '//*[@href="#method.foo"]' 'foo' + pub fn foo() {} +} + +impl Bar for Foo { + //@ has - '//*[@href="trait.Bar.html#associatedtype.Bar"]' 'Bar' + //@ has - '//*[@href="trait.Bar.html#associatedconstant.Baz"]' 'Baz' + //@ has - '//*[@href="trait.Bar.html#tymethod.bar"]' 'bar' + fn bar() {} + //@ has - '//*[@href="trait.Bar.html#method.baz"]' 'baz' +} diff --git a/tests/rustdoc/anchors/anchors.no_const_anchor.html b/tests/rustdoc/anchors/anchors.no_const_anchor.html new file mode 100644 index 00000000000..07a7507fa2e --- /dev/null +++ b/tests/rustdoc/anchors/anchors.no_const_anchor.html @@ -0,0 +1 @@ +
Source

const YOLO: u32

\ No newline at end of file diff --git a/tests/rustdoc/anchors/anchors.no_const_anchor2.html b/tests/rustdoc/anchors/anchors.no_const_anchor2.html new file mode 100644 index 00000000000..091dac3e4b2 --- /dev/null +++ b/tests/rustdoc/anchors/anchors.no_const_anchor2.html @@ -0,0 +1 @@ +
Source

pub const X: i32 = 0i32

\ No newline at end of file diff --git a/tests/rustdoc/anchors/anchors.no_method_anchor.html b/tests/rustdoc/anchors/anchors.no_method_anchor.html new file mode 100644 index 00000000000..89f9898624c --- /dev/null +++ b/tests/rustdoc/anchors/anchors.no_method_anchor.html @@ -0,0 +1 @@ +
Source

pub fn new() -> Self

\ No newline at end of file diff --git a/tests/rustdoc/anchors/anchors.no_trait_method_anchor.html b/tests/rustdoc/anchors/anchors.no_trait_method_anchor.html new file mode 100644 index 00000000000..51656a3e58f --- /dev/null +++ b/tests/rustdoc/anchors/anchors.no_trait_method_anchor.html @@ -0,0 +1 @@ +
Source

fn bar()

\ No newline at end of file diff --git a/tests/rustdoc/anchors/anchors.no_tymethod_anchor.html b/tests/rustdoc/anchors/anchors.no_tymethod_anchor.html new file mode 100644 index 00000000000..49ee624bdbc --- /dev/null +++ b/tests/rustdoc/anchors/anchors.no_tymethod_anchor.html @@ -0,0 +1 @@ +
Source

fn foo()

\ No newline at end of file diff --git a/tests/rustdoc/anchors/anchors.no_type_anchor.html b/tests/rustdoc/anchors/anchors.no_type_anchor.html new file mode 100644 index 00000000000..c5ac3c93818 --- /dev/null +++ b/tests/rustdoc/anchors/anchors.no_type_anchor.html @@ -0,0 +1 @@ +
Source

type T

\ No newline at end of file diff --git a/tests/rustdoc/anchors/anchors.no_type_anchor2.html b/tests/rustdoc/anchors/anchors.no_type_anchor2.html new file mode 100644 index 00000000000..14dd31d87b6 --- /dev/null +++ b/tests/rustdoc/anchors/anchors.no_type_anchor2.html @@ -0,0 +1 @@ +
Source

pub type Y = u32

\ No newline at end of file diff --git a/tests/rustdoc/anchors/anchors.rs b/tests/rustdoc/anchors/anchors.rs new file mode 100644 index 00000000000..255ef87351c --- /dev/null +++ b/tests/rustdoc/anchors/anchors.rs @@ -0,0 +1,49 @@ +// This test ensures that anchors are generated in the right places. + +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] +#![crate_name = "foo"] + +pub struct Foo; + +//@ has 'foo/trait.Bar.html' +pub trait Bar { + // There should be no anchors here. + //@ snapshot no_type_anchor - '//*[@id="associatedtype.T"]' + type T; + // There should be no anchors here. + //@ snapshot no_const_anchor - '//*[@id="associatedconstant.YOLO"]' + const YOLO: u32; + + // There should be no anchors here. + //@ snapshot no_tymethod_anchor - '//*[@id="tymethod.foo"]' + fn foo(); + // There should be no anchors here. + //@ snapshot no_trait_method_anchor - '//*[@id="method.bar"]' + fn bar() {} +} + +//@ has 'foo/struct.Foo.html' +impl Bar for Foo { + //@ has - '//*[@id="associatedtype.T"]/a[@class="anchor"]' '' + type T = u32; + //@ has - '//*[@id="associatedconstant.YOLO"]/a[@class="anchor"]' '' + const YOLO: u32 = 0; + + //@ has - '//*[@id="method.foo"]/a[@class="anchor"]' '' + fn foo() {} + // Same check for provided "bar" method. + //@ has - '//*[@id="method.bar"]/a[@class="anchor"]' '' +} + +impl Foo { + //@ snapshot no_const_anchor2 - '//*[@id="associatedconstant.X"]' + // There should be no anchors here. + pub const X: i32 = 0; + //@ snapshot no_type_anchor2 - '//*[@id="associatedtype.Y"]' + // There should be no anchors here. + pub type Y = u32; + //@ snapshot no_method_anchor - '//*[@id="method.new"]' + // There should be no anchors here. + pub fn new() -> Self { Self } +} diff --git a/tests/rustdoc/anchors/auxiliary/issue-86620-1.rs b/tests/rustdoc/anchors/auxiliary/issue-86620-1.rs new file mode 100644 index 00000000000..f6debf6fb4e --- /dev/null +++ b/tests/rustdoc/anchors/auxiliary/issue-86620-1.rs @@ -0,0 +1,11 @@ +#![crate_name = "issue_86620_1"] + +pub trait VZip { + fn vzip() -> usize; +} + +impl VZip for T { + fn vzip() -> usize { + 0 + } +} diff --git a/tests/rustdoc/anchors/disambiguate-anchors-32890.rs b/tests/rustdoc/anchors/disambiguate-anchors-32890.rs new file mode 100644 index 00000000000..0b726d5fba4 --- /dev/null +++ b/tests/rustdoc/anchors/disambiguate-anchors-32890.rs @@ -0,0 +1,20 @@ +// https://github.com/rust-lang/rust/issues/32890 +#![crate_name="issue_32890"] + +//@ has issue_32890/struct.Foo.html +pub struct Foo(T); + +impl Foo { + //@ has - '//a[@href="#method.pass"]' 'pass' + pub fn pass() {} +} + +impl Foo { + //@ has - '//a[@href="#method.pass-1"]' 'pass' + pub fn pass() {} +} + +impl Foo { + //@ has - '//a[@href="#method.pass-2"]' 'pass' + pub fn pass() {} +} diff --git a/tests/rustdoc/anchors/disambiguate-anchors-header-29449.rs b/tests/rustdoc/anchors/disambiguate-anchors-header-29449.rs new file mode 100644 index 00000000000..feb0632775e --- /dev/null +++ b/tests/rustdoc/anchors/disambiguate-anchors-header-29449.rs @@ -0,0 +1,28 @@ +// https://github.com/rust-lang/rust/issues/29449 +#![crate_name="issue_29449"] + +//@ has issue_29449/struct.Foo.html +pub struct Foo; + +impl Foo { + //@ has - '//*[@id="examples"]' 'Examples' + //@ has - '//*[@id="examples"]/a[@href="#examples"]' '§' + //@ has - '//*[@id="panics"]' 'Panics' + //@ has - '//*[@id="panics"]/a[@href="#panics"]' '§' + /// # Examples + /// # Panics + pub fn bar() {} + + //@ has - '//*[@id="examples-1"]' 'Examples' + //@ has - '//*[@id="examples-1"]/a[@href="#examples-1"]' '§' + /// # Examples + pub fn bar_1() {} + + //@ has - '//*[@id="examples-2"]' 'Examples' + //@ has - '//*[@id="examples-2"]/a[@href="#examples-2"]' '§' + //@ has - '//*[@id="panics-1"]' 'Panics' + //@ has - '//*[@id="panics-1"]/a[@href="#panics-1"]' '§' + /// # Examples + /// # Panics + pub fn bar_2() {} +} diff --git a/tests/rustdoc/anchors/extern-default-method.no_href_on_anchor.html b/tests/rustdoc/anchors/extern-default-method.no_href_on_anchor.html new file mode 100644 index 00000000000..ef14836ccb8 --- /dev/null +++ b/tests/rustdoc/anchors/extern-default-method.no_href_on_anchor.html @@ -0,0 +1 @@ +provided(&self) \ No newline at end of file diff --git a/tests/rustdoc/anchors/method-anchor-in-blanket-impl-86620.rs b/tests/rustdoc/anchors/method-anchor-in-blanket-impl-86620.rs new file mode 100644 index 00000000000..89e8712169a --- /dev/null +++ b/tests/rustdoc/anchors/method-anchor-in-blanket-impl-86620.rs @@ -0,0 +1,11 @@ +//@ aux-build:issue-86620-1.rs +#![crate_name = "foo"] +// https://github.com/rust-lang/rust/issues/86620 + +extern crate issue_86620_1; + +use issue_86620_1::*; + +//@ !has foo/struct.S.html '//*[@id="method.vzip"]//a[@class="fnname"]/@href' #tymethod.vzip +//@ has foo/struct.S.html '//*[@id="method.vzip"]//a[@class="anchor"]/@href' #method.vzip +pub struct S; diff --git a/tests/rustdoc/anchors/trait-impl-items-links-and-anchors.rs b/tests/rustdoc/anchors/trait-impl-items-links-and-anchors.rs new file mode 100644 index 00000000000..c1845a33b9d --- /dev/null +++ b/tests/rustdoc/anchors/trait-impl-items-links-and-anchors.rs @@ -0,0 +1,65 @@ +pub trait MyTrait { + type Assoc; + const VALUE: u32 = 12; + fn trait_function(&self); + fn defaulted(&self) {} + fn defaulted_override(&self) {} +} + +impl MyTrait for String { + //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="associatedtype.Assoc-1"]//a[@class="associatedtype"]/@href' #associatedtype.Assoc + //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="associatedtype.Assoc-1"]//a[@class="anchor"]/@href' #associatedtype.Assoc-1 + type Assoc = (); + //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="associatedconstant.VALUE-1"]//a[@class="constant"]/@href' #associatedconstant.VALUE + //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="associatedconstant.VALUE-1"]//a[@class="anchor"]/@href' #associatedconstant.VALUE-1 + const VALUE: u32 = 5; + //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="method.trait_function"]//a[@class="fn"]/@href' #tymethod.trait_function + //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="method.trait_function"]//a[@class="anchor"]/@href' #method.trait_function + fn trait_function(&self) {} + //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="method.defaulted_override-1"]//a[@class="fn"]/@href' #method.defaulted_override + //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="method.defaulted_override-1"]//a[@class="anchor"]/@href' #method.defaulted_override-1 + fn defaulted_override(&self) {} +} + +impl MyTrait for Vec { + //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="associatedtype.Assoc-2"]//a[@class="associatedtype"]/@href' #associatedtype.Assoc + //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="associatedtype.Assoc-2"]//a[@class="anchor"]/@href' #associatedtype.Assoc-2 + type Assoc = (); + //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="associatedconstant.VALUE-2"]//a[@class="constant"]/@href' #associatedconstant.VALUE + //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="associatedconstant.VALUE-2"]//a[@class="anchor"]/@href' #associatedconstant.VALUE-2 + const VALUE: u32 = 5; + //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="method.trait_function"]//a[@class="fn"]/@href' #tymethod.trait_function + //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="method.trait_function-1"]//a[@class="anchor"]/@href' #method.trait_function-1 + fn trait_function(&self) {} + //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="method.defaulted_override-2"]//a[@class="fn"]/@href' #method.defaulted_override + //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="method.defaulted_override-2"]//a[@class="anchor"]/@href' #method.defaulted_override-2 + fn defaulted_override(&self) {} +} + +impl MyTrait for MyStruct { + //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="associatedtype.Assoc-3"]//a[@class="anchor"]/@href' #associatedtype.Assoc-3 + //@ has trait_impl_items_links_and_anchors/struct.MyStruct.html '//*[@id="associatedtype.Assoc"]//a[@class="associatedtype"]/@href' trait.MyTrait.html#associatedtype.Assoc + //@ has trait_impl_items_links_and_anchors/struct.MyStruct.html '//*[@id="associatedtype.Assoc"]//a[@class="anchor"]/@href' #associatedtype.Assoc + type Assoc = bool; + //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="associatedconstant.VALUE-3"]//a[@class="anchor"]/@href' #associatedconstant.VALUE-3 + //@ has trait_impl_items_links_and_anchors/struct.MyStruct.html '//*[@id="associatedconstant.VALUE"]//a[@class="constant"]/@href' trait.MyTrait.html#associatedconstant.VALUE + //@ has trait_impl_items_links_and_anchors/struct.MyStruct.html '//*[@id="associatedconstant.VALUE"]//a[@class="anchor"]/@href' #associatedconstant.VALUE + const VALUE: u32 = 20; + //@ has trait_impl_items_links_and_anchors/struct.MyStruct.html '//*[@id="method.trait_function"]//a[@class="fn"]/@href' trait.MyTrait.html#tymethod.trait_function + //@ has trait_impl_items_links_and_anchors/struct.MyStruct.html '//*[@id="method.trait_function"]//a[@class="anchor"]/@href' #method.trait_function + fn trait_function(&self) {} + //@ has trait_impl_items_links_and_anchors/struct.MyStruct.html '//*[@id="method.defaulted_override"]//a[@class="fn"]/@href' trait.MyTrait.html#method.defaulted_override + //@ has trait_impl_items_links_and_anchors/struct.MyStruct.html '//*[@id="method.defaulted_override"]//a[@class="anchor"]/@href' #method.defaulted_override + fn defaulted_override(&self) {} + //@ has trait_impl_items_links_and_anchors/struct.MyStruct.html '//*[@id="method.defaulted"]//a[@class="fn"]/@href' trait.MyTrait.html#method.defaulted + //@ has trait_impl_items_links_and_anchors/struct.MyStruct.html '//*[@id="method.defaulted"]//a[@class="anchor"]/@href' #method.defaulted +} + +pub struct MyStruct; + +// We check that associated items with default values aren't generated in the implementors list. +impl MyTrait for (u8, u8) { + //@ !has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-4"]' '' + type Assoc = bool; + fn trait_function(&self) {} +} diff --git a/tests/rustdoc/auxiliary/issue-86620-1.rs b/tests/rustdoc/auxiliary/issue-86620-1.rs deleted file mode 100644 index f6debf6fb4e..00000000000 --- a/tests/rustdoc/auxiliary/issue-86620-1.rs +++ /dev/null @@ -1,11 +0,0 @@ -#![crate_name = "issue_86620_1"] - -pub trait VZip { - fn vzip() -> usize; -} - -impl VZip for T { - fn vzip() -> usize { - 0 - } -} diff --git a/tests/rustdoc/disambiguate-anchors-32890.rs b/tests/rustdoc/disambiguate-anchors-32890.rs deleted file mode 100644 index 0b726d5fba4..00000000000 --- a/tests/rustdoc/disambiguate-anchors-32890.rs +++ /dev/null @@ -1,20 +0,0 @@ -// https://github.com/rust-lang/rust/issues/32890 -#![crate_name="issue_32890"] - -//@ has issue_32890/struct.Foo.html -pub struct Foo(T); - -impl Foo { - //@ has - '//a[@href="#method.pass"]' 'pass' - pub fn pass() {} -} - -impl Foo { - //@ has - '//a[@href="#method.pass-1"]' 'pass' - pub fn pass() {} -} - -impl Foo { - //@ has - '//a[@href="#method.pass-2"]' 'pass' - pub fn pass() {} -} diff --git a/tests/rustdoc/disambiguate-anchors-header-29449.rs b/tests/rustdoc/disambiguate-anchors-header-29449.rs deleted file mode 100644 index feb0632775e..00000000000 --- a/tests/rustdoc/disambiguate-anchors-header-29449.rs +++ /dev/null @@ -1,28 +0,0 @@ -// https://github.com/rust-lang/rust/issues/29449 -#![crate_name="issue_29449"] - -//@ has issue_29449/struct.Foo.html -pub struct Foo; - -impl Foo { - //@ has - '//*[@id="examples"]' 'Examples' - //@ has - '//*[@id="examples"]/a[@href="#examples"]' '§' - //@ has - '//*[@id="panics"]' 'Panics' - //@ has - '//*[@id="panics"]/a[@href="#panics"]' '§' - /// # Examples - /// # Panics - pub fn bar() {} - - //@ has - '//*[@id="examples-1"]' 'Examples' - //@ has - '//*[@id="examples-1"]/a[@href="#examples-1"]' '§' - /// # Examples - pub fn bar_1() {} - - //@ has - '//*[@id="examples-2"]' 'Examples' - //@ has - '//*[@id="examples-2"]/a[@href="#examples-2"]' '§' - //@ has - '//*[@id="panics-1"]' 'Panics' - //@ has - '//*[@id="panics-1"]/a[@href="#panics-1"]' '§' - /// # Examples - /// # Panics - pub fn bar_2() {} -} diff --git a/tests/rustdoc/extern-default-method.no_href_on_anchor.html b/tests/rustdoc/extern-default-method.no_href_on_anchor.html deleted file mode 100644 index ef14836ccb8..00000000000 --- a/tests/rustdoc/extern-default-method.no_href_on_anchor.html +++ /dev/null @@ -1 +0,0 @@ -provided(&self) \ No newline at end of file diff --git a/tests/rustdoc/method-anchor-in-blanket-impl-86620.rs b/tests/rustdoc/method-anchor-in-blanket-impl-86620.rs deleted file mode 100644 index 89e8712169a..00000000000 --- a/tests/rustdoc/method-anchor-in-blanket-impl-86620.rs +++ /dev/null @@ -1,11 +0,0 @@ -//@ aux-build:issue-86620-1.rs -#![crate_name = "foo"] -// https://github.com/rust-lang/rust/issues/86620 - -extern crate issue_86620_1; - -use issue_86620_1::*; - -//@ !has foo/struct.S.html '//*[@id="method.vzip"]//a[@class="fnname"]/@href' #tymethod.vzip -//@ has foo/struct.S.html '//*[@id="method.vzip"]//a[@class="anchor"]/@href' #method.vzip -pub struct S; diff --git a/tests/rustdoc/trait-impl-items-links-and-anchors.rs b/tests/rustdoc/trait-impl-items-links-and-anchors.rs deleted file mode 100644 index c1845a33b9d..00000000000 --- a/tests/rustdoc/trait-impl-items-links-and-anchors.rs +++ /dev/null @@ -1,65 +0,0 @@ -pub trait MyTrait { - type Assoc; - const VALUE: u32 = 12; - fn trait_function(&self); - fn defaulted(&self) {} - fn defaulted_override(&self) {} -} - -impl MyTrait for String { - //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="associatedtype.Assoc-1"]//a[@class="associatedtype"]/@href' #associatedtype.Assoc - //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="associatedtype.Assoc-1"]//a[@class="anchor"]/@href' #associatedtype.Assoc-1 - type Assoc = (); - //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="associatedconstant.VALUE-1"]//a[@class="constant"]/@href' #associatedconstant.VALUE - //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="associatedconstant.VALUE-1"]//a[@class="anchor"]/@href' #associatedconstant.VALUE-1 - const VALUE: u32 = 5; - //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="method.trait_function"]//a[@class="fn"]/@href' #tymethod.trait_function - //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="method.trait_function"]//a[@class="anchor"]/@href' #method.trait_function - fn trait_function(&self) {} - //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="method.defaulted_override-1"]//a[@class="fn"]/@href' #method.defaulted_override - //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="method.defaulted_override-1"]//a[@class="anchor"]/@href' #method.defaulted_override-1 - fn defaulted_override(&self) {} -} - -impl MyTrait for Vec { - //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="associatedtype.Assoc-2"]//a[@class="associatedtype"]/@href' #associatedtype.Assoc - //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="associatedtype.Assoc-2"]//a[@class="anchor"]/@href' #associatedtype.Assoc-2 - type Assoc = (); - //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="associatedconstant.VALUE-2"]//a[@class="constant"]/@href' #associatedconstant.VALUE - //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="associatedconstant.VALUE-2"]//a[@class="anchor"]/@href' #associatedconstant.VALUE-2 - const VALUE: u32 = 5; - //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="method.trait_function"]//a[@class="fn"]/@href' #tymethod.trait_function - //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="method.trait_function-1"]//a[@class="anchor"]/@href' #method.trait_function-1 - fn trait_function(&self) {} - //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="method.defaulted_override-2"]//a[@class="fn"]/@href' #method.defaulted_override - //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="method.defaulted_override-2"]//a[@class="anchor"]/@href' #method.defaulted_override-2 - fn defaulted_override(&self) {} -} - -impl MyTrait for MyStruct { - //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="associatedtype.Assoc-3"]//a[@class="anchor"]/@href' #associatedtype.Assoc-3 - //@ has trait_impl_items_links_and_anchors/struct.MyStruct.html '//*[@id="associatedtype.Assoc"]//a[@class="associatedtype"]/@href' trait.MyTrait.html#associatedtype.Assoc - //@ has trait_impl_items_links_and_anchors/struct.MyStruct.html '//*[@id="associatedtype.Assoc"]//a[@class="anchor"]/@href' #associatedtype.Assoc - type Assoc = bool; - //@ has trait_impl_items_links_and_anchors/trait.MyTrait.html '//*[@id="associatedconstant.VALUE-3"]//a[@class="anchor"]/@href' #associatedconstant.VALUE-3 - //@ has trait_impl_items_links_and_anchors/struct.MyStruct.html '//*[@id="associatedconstant.VALUE"]//a[@class="constant"]/@href' trait.MyTrait.html#associatedconstant.VALUE - //@ has trait_impl_items_links_and_anchors/struct.MyStruct.html '//*[@id="associatedconstant.VALUE"]//a[@class="anchor"]/@href' #associatedconstant.VALUE - const VALUE: u32 = 20; - //@ has trait_impl_items_links_and_anchors/struct.MyStruct.html '//*[@id="method.trait_function"]//a[@class="fn"]/@href' trait.MyTrait.html#tymethod.trait_function - //@ has trait_impl_items_links_and_anchors/struct.MyStruct.html '//*[@id="method.trait_function"]//a[@class="anchor"]/@href' #method.trait_function - fn trait_function(&self) {} - //@ has trait_impl_items_links_and_anchors/struct.MyStruct.html '//*[@id="method.defaulted_override"]//a[@class="fn"]/@href' trait.MyTrait.html#method.defaulted_override - //@ has trait_impl_items_links_and_anchors/struct.MyStruct.html '//*[@id="method.defaulted_override"]//a[@class="anchor"]/@href' #method.defaulted_override - fn defaulted_override(&self) {} - //@ has trait_impl_items_links_and_anchors/struct.MyStruct.html '//*[@id="method.defaulted"]//a[@class="fn"]/@href' trait.MyTrait.html#method.defaulted - //@ has trait_impl_items_links_and_anchors/struct.MyStruct.html '//*[@id="method.defaulted"]//a[@class="anchor"]/@href' #method.defaulted -} - -pub struct MyStruct; - -// We check that associated items with default values aren't generated in the implementors list. -impl MyTrait for (u8, u8) { - //@ !has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-4"]' '' - type Assoc = bool; - fn trait_function(&self) {} -} -- cgit 1.4.1-3-g733a5