diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 611fecca0546b..1df50322a0732 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -688,38 +688,6 @@ impl Step for RustdocJSNotStd { } } -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct RustdocUi { - pub target: TargetSelection, - pub compiler: Compiler, -} - -impl Step for RustdocUi { - type Output = (); - const DEFAULT: bool = true; - const ONLY_HOSTS: bool = true; - - fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { - run.path("src/test/rustdoc-ui") - } - - fn make_run(run: RunConfig<'_>) { - let compiler = run.builder.compiler(run.builder.top_stage, run.build_triple()); - run.builder.ensure(RustdocUi { target: run.target, compiler }); - } - - fn run(self, builder: &Builder<'_>) { - builder.ensure(Compiletest { - compiler: self.compiler, - target: self.target, - mode: "ui", - suite: "rustdoc-ui", - path: "src/test/rustdoc-ui", - compare_mode: None, - }) - } -} - #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub struct Tidy; @@ -934,6 +902,7 @@ default_test!(Debuginfo { path: "src/test/debuginfo", mode: "debuginfo", suite: host_test!(UiFullDeps { path: "src/test/ui-fulldeps", mode: "ui", suite: "ui-fulldeps" }); host_test!(Rustdoc { path: "src/test/rustdoc", mode: "rustdoc", suite: "rustdoc" }); +host_test!(RustdocUi { path: "src/test/rustdoc-ui", mode: "ui", suite: "rustdoc-ui" }); host_test!(Pretty { path: "src/test/pretty", mode: "pretty", suite: "pretty" }); diff --git a/src/test/rustdoc-ui/.gitattributes b/src/test/rustdoc-ui/.gitattributes deleted file mode 100644 index 2bcabdffb3d93..0000000000000 --- a/src/test/rustdoc-ui/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -intra-links-warning-crlf.rs eol=crlf diff --git a/src/test/rustdoc-ui/intra-doc/.gitattributes b/src/test/rustdoc-ui/intra-doc/.gitattributes new file mode 100644 index 0000000000000..6c125fac52f5e --- /dev/null +++ b/src/test/rustdoc-ui/intra-doc/.gitattributes @@ -0,0 +1 @@ +warning-crlf.rs eol=crlf diff --git a/src/test/rustdoc-ui/intra-doc-alias-ice.rs b/src/test/rustdoc-ui/intra-doc/alias-ice.rs similarity index 100% rename from src/test/rustdoc-ui/intra-doc-alias-ice.rs rename to src/test/rustdoc-ui/intra-doc/alias-ice.rs diff --git a/src/test/rustdoc-ui/intra-doc-alias-ice.stderr b/src/test/rustdoc-ui/intra-doc/alias-ice.stderr similarity index 82% rename from src/test/rustdoc-ui/intra-doc-alias-ice.stderr rename to src/test/rustdoc-ui/intra-doc/alias-ice.stderr index 771fc2204f5f8..3db5fad4cfbdc 100644 --- a/src/test/rustdoc-ui/intra-doc-alias-ice.stderr +++ b/src/test/rustdoc-ui/intra-doc/alias-ice.stderr @@ -1,11 +1,11 @@ error: unresolved link to `TypeAlias::hoge` - --> $DIR/intra-doc-alias-ice.rs:5:30 + --> $DIR/alias-ice.rs:5:30 | LL | /// [broken cross-reference](TypeAlias::hoge) | ^^^^^^^^^^^^^^^ the type alias `TypeAlias` has no associated item named `hoge` | note: the lint level is defined here - --> $DIR/intra-doc-alias-ice.rs:1:9 + --> $DIR/alias-ice.rs:1:9 | LL | #![deny(broken_intra_doc_links)] | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/rustdoc-ui/intra-links-ambiguity.rs b/src/test/rustdoc-ui/intra-doc/ambiguity.rs similarity index 100% rename from src/test/rustdoc-ui/intra-links-ambiguity.rs rename to src/test/rustdoc-ui/intra-doc/ambiguity.rs diff --git a/src/test/rustdoc-ui/intra-links-ambiguity.stderr b/src/test/rustdoc-ui/intra-doc/ambiguity.stderr similarity index 90% rename from src/test/rustdoc-ui/intra-links-ambiguity.stderr rename to src/test/rustdoc-ui/intra-doc/ambiguity.stderr index 936055da01cf7..7e967dc88bcdd 100644 --- a/src/test/rustdoc-ui/intra-links-ambiguity.stderr +++ b/src/test/rustdoc-ui/intra-doc/ambiguity.stderr @@ -1,11 +1,11 @@ error: `true` is both a module and a builtin type - --> $DIR/intra-links-ambiguity.rs:38:6 + --> $DIR/ambiguity.rs:38:6 | LL | /// [true] | ^^^^ ambiguous link | note: the lint level is defined here - --> $DIR/intra-links-ambiguity.rs:1:9 + --> $DIR/ambiguity.rs:1:9 | LL | #![deny(broken_intra_doc_links)] | ^^^^^^^^^^^^^^^^^^^^^^ @@ -19,7 +19,7 @@ LL | /// [prim@true] | ^^^^^^^^^ error: `ambiguous` is both a struct and a function - --> $DIR/intra-links-ambiguity.rs:27:6 + --> $DIR/ambiguity.rs:27:6 | LL | /// [`ambiguous`] is ambiguous. | ^^^^^^^^^^^ ambiguous link @@ -34,7 +34,7 @@ LL | /// [`ambiguous()`] is ambiguous. | ^^^^^^^^^^^^^ error: `ambiguous` is both a struct and a function - --> $DIR/intra-links-ambiguity.rs:29:6 + --> $DIR/ambiguity.rs:29:6 | LL | /// [ambiguous] is ambiguous. | ^^^^^^^^^ ambiguous link @@ -49,7 +49,7 @@ LL | /// [ambiguous()] is ambiguous. | ^^^^^^^^^^^ error: `multi_conflict` is a struct, a function, and a macro - --> $DIR/intra-links-ambiguity.rs:31:6 + --> $DIR/ambiguity.rs:31:6 | LL | /// [`multi_conflict`] is a three-way conflict. | ^^^^^^^^^^^^^^^^ ambiguous link @@ -68,7 +68,7 @@ LL | /// [`multi_conflict!`] is a three-way conflict. | ^^^^^^^^^^^^^^^^^ error: `type_and_value` is both a module and a constant - --> $DIR/intra-links-ambiguity.rs:33:16 + --> $DIR/ambiguity.rs:33:16 | LL | /// Ambiguous [type_and_value]. | ^^^^^^^^^^^^^^ ambiguous link @@ -83,7 +83,7 @@ LL | /// Ambiguous [const@type_and_value]. | ^^^^^^^^^^^^^^^^^^^^ error: `foo::bar` is both an enum and a function - --> $DIR/intra-links-ambiguity.rs:35:42 + --> $DIR/ambiguity.rs:35:42 | LL | /// Ambiguous non-implied shortcut link [`foo::bar`]. | ^^^^^^^^^^ ambiguous link diff --git a/src/test/rustdoc-ui/intra-links-anchors.rs b/src/test/rustdoc-ui/intra-doc/anchors.rs similarity index 100% rename from src/test/rustdoc-ui/intra-links-anchors.rs rename to src/test/rustdoc-ui/intra-doc/anchors.rs diff --git a/src/test/rustdoc-ui/intra-links-anchors.stderr b/src/test/rustdoc-ui/intra-doc/anchors.stderr similarity index 81% rename from src/test/rustdoc-ui/intra-links-anchors.stderr rename to src/test/rustdoc-ui/intra-doc/anchors.stderr index 1825a4ad1fa6b..5b272d960d50f 100644 --- a/src/test/rustdoc-ui/intra-links-anchors.stderr +++ b/src/test/rustdoc-ui/intra-doc/anchors.stderr @@ -1,29 +1,29 @@ error: `Foo::f#hola` contains an anchor, but links to fields are already anchored - --> $DIR/intra-links-anchors.rs:25:15 + --> $DIR/anchors.rs:25:15 | LL | /// Or maybe [Foo::f#hola]. | ^^^^^^^^^^^ contains invalid anchor | note: the lint level is defined here - --> $DIR/intra-links-anchors.rs:1:9 + --> $DIR/anchors.rs:1:9 | LL | #![deny(broken_intra_doc_links)] | ^^^^^^^^^^^^^^^^^^^^^^ error: `hello#people#!` contains multiple anchors - --> $DIR/intra-links-anchors.rs:31:28 + --> $DIR/anchors.rs:31:28 | LL | /// Another anchor error: [hello#people#!]. | ^^^^^^^^^^^^^^ contains invalid anchor error: `Enum::A#whatever` contains an anchor, but links to variants are already anchored - --> $DIR/intra-links-anchors.rs:37:28 + --> $DIR/anchors.rs:37:28 | LL | /// Damn enum's variants: [Enum::A#whatever]. | ^^^^^^^^^^^^^^^^ contains invalid anchor error: `u32#hello` contains an anchor, but links to builtin types are already anchored - --> $DIR/intra-links-anchors.rs:43:6 + --> $DIR/anchors.rs:43:6 | LL | /// [u32#hello] | ^^^^^^^^^ contains invalid anchor diff --git a/src/test/rustdoc-ui/auxiliary/intra-doc-broken.rs b/src/test/rustdoc-ui/intra-doc/auxiliary/intra-doc-broken.rs similarity index 100% rename from src/test/rustdoc-ui/auxiliary/intra-doc-broken.rs rename to src/test/rustdoc-ui/intra-doc/auxiliary/intra-doc-broken.rs diff --git a/src/test/rustdoc-ui/intra-doc-broken-reexport.rs b/src/test/rustdoc-ui/intra-doc/broken-reexport.rs similarity index 100% rename from src/test/rustdoc-ui/intra-doc-broken-reexport.rs rename to src/test/rustdoc-ui/intra-doc/broken-reexport.rs diff --git a/src/test/rustdoc-ui/intra-links-disambiguator-mismatch.rs b/src/test/rustdoc-ui/intra-doc/disambiguator-mismatch.rs similarity index 100% rename from src/test/rustdoc-ui/intra-links-disambiguator-mismatch.rs rename to src/test/rustdoc-ui/intra-doc/disambiguator-mismatch.rs diff --git a/src/test/rustdoc-ui/intra-links-disambiguator-mismatch.stderr b/src/test/rustdoc-ui/intra-doc/disambiguator-mismatch.stderr similarity index 80% rename from src/test/rustdoc-ui/intra-links-disambiguator-mismatch.stderr rename to src/test/rustdoc-ui/intra-doc/disambiguator-mismatch.stderr index 2e732baf6e01e..2f5f3daa29785 100644 --- a/src/test/rustdoc-ui/intra-links-disambiguator-mismatch.stderr +++ b/src/test/rustdoc-ui/intra-doc/disambiguator-mismatch.stderr @@ -1,18 +1,18 @@ error: incompatible link kind for `S` - --> $DIR/intra-links-disambiguator-mismatch.rs:14:14 + --> $DIR/disambiguator-mismatch.rs:14:14 | LL | /// Link to [struct@S] | ^^^^^^^^ help: to link to the enum, prefix with `enum@`: `enum@S` | note: the lint level is defined here - --> $DIR/intra-links-disambiguator-mismatch.rs:1:9 + --> $DIR/disambiguator-mismatch.rs:1:9 | LL | #![deny(broken_intra_doc_links)] | ^^^^^^^^^^^^^^^^^^^^^^ = note: this link resolved to an enum, which is not a struct error: incompatible link kind for `S` - --> $DIR/intra-links-disambiguator-mismatch.rs:19:14 + --> $DIR/disambiguator-mismatch.rs:19:14 | LL | /// Link to [mod@S] | ^^^^^ help: to link to the enum, prefix with `enum@`: `enum@S` @@ -20,7 +20,7 @@ LL | /// Link to [mod@S] = note: this link resolved to an enum, which is not a module error: incompatible link kind for `S` - --> $DIR/intra-links-disambiguator-mismatch.rs:24:14 + --> $DIR/disambiguator-mismatch.rs:24:14 | LL | /// Link to [union@S] | ^^^^^^^ help: to link to the enum, prefix with `enum@`: `enum@S` @@ -28,7 +28,7 @@ LL | /// Link to [union@S] = note: this link resolved to an enum, which is not a union error: incompatible link kind for `S` - --> $DIR/intra-links-disambiguator-mismatch.rs:29:14 + --> $DIR/disambiguator-mismatch.rs:29:14 | LL | /// Link to [trait@S] | ^^^^^^^ help: to link to the enum, prefix with `enum@`: `enum@S` @@ -36,7 +36,7 @@ LL | /// Link to [trait@S] = note: this link resolved to an enum, which is not a trait error: incompatible link kind for `T` - --> $DIR/intra-links-disambiguator-mismatch.rs:34:14 + --> $DIR/disambiguator-mismatch.rs:34:14 | LL | /// Link to [struct@T] | ^^^^^^^^ help: to link to the trait, prefix with `trait@`: `trait@T` @@ -44,7 +44,7 @@ LL | /// Link to [struct@T] = note: this link resolved to a trait, which is not a struct error: incompatible link kind for `m` - --> $DIR/intra-links-disambiguator-mismatch.rs:39:14 + --> $DIR/disambiguator-mismatch.rs:39:14 | LL | /// Link to [derive@m] | ^^^^^^^^ help: to link to the macro, add an exclamation mark: `m!` @@ -52,7 +52,7 @@ LL | /// Link to [derive@m] = note: this link resolved to a macro, which is not a derive macro error: incompatible link kind for `s` - --> $DIR/intra-links-disambiguator-mismatch.rs:44:14 + --> $DIR/disambiguator-mismatch.rs:44:14 | LL | /// Link to [const@s] | ^^^^^^^ help: to link to the static, prefix with `static@`: `static@s` @@ -60,7 +60,7 @@ LL | /// Link to [const@s] = note: this link resolved to a static, which is not a constant error: incompatible link kind for `c` - --> $DIR/intra-links-disambiguator-mismatch.rs:49:14 + --> $DIR/disambiguator-mismatch.rs:49:14 | LL | /// Link to [static@c] | ^^^^^^^^ help: to link to the constant, prefix with `const@`: `const@c` @@ -68,7 +68,7 @@ LL | /// Link to [static@c] = note: this link resolved to a constant, which is not a static error: incompatible link kind for `c` - --> $DIR/intra-links-disambiguator-mismatch.rs:54:14 + --> $DIR/disambiguator-mismatch.rs:54:14 | LL | /// Link to [fn@c] | ^^^^ help: to link to the constant, prefix with `const@`: `const@c` @@ -76,7 +76,7 @@ LL | /// Link to [fn@c] = note: this link resolved to a constant, which is not a function error: incompatible link kind for `c` - --> $DIR/intra-links-disambiguator-mismatch.rs:59:14 + --> $DIR/disambiguator-mismatch.rs:59:14 | LL | /// Link to [c()] | ^^^ help: to link to the constant, prefix with `const@`: `const@c` @@ -84,7 +84,7 @@ LL | /// Link to [c()] = note: this link resolved to a constant, which is not a function error: incompatible link kind for `f` - --> $DIR/intra-links-disambiguator-mismatch.rs:64:14 + --> $DIR/disambiguator-mismatch.rs:64:14 | LL | /// Link to [const@f] | ^^^^^^^ help: to link to the function, add parentheses: `f()` diff --git a/src/test/rustdoc-ui/intra-link-double-anchor.rs b/src/test/rustdoc-ui/intra-doc/double-anchor.rs similarity index 100% rename from src/test/rustdoc-ui/intra-link-double-anchor.rs rename to src/test/rustdoc-ui/intra-doc/double-anchor.rs diff --git a/src/test/rustdoc-ui/intra-link-double-anchor.stderr b/src/test/rustdoc-ui/intra-doc/double-anchor.stderr similarity index 85% rename from src/test/rustdoc-ui/intra-link-double-anchor.stderr rename to src/test/rustdoc-ui/intra-doc/double-anchor.stderr index 3282ec8b79379..1cd9231eded4d 100644 --- a/src/test/rustdoc-ui/intra-link-double-anchor.stderr +++ b/src/test/rustdoc-ui/intra-doc/double-anchor.stderr @@ -1,5 +1,5 @@ warning: `with#anchor#error` contains multiple anchors - --> $DIR/intra-link-double-anchor.rs:5:18 + --> $DIR/double-anchor.rs:5:18 | LL | /// docs [label][with#anchor#error] | ^^^^^^^^^^^^^^^^^ contains invalid anchor diff --git a/src/test/rustdoc-ui/intra-link-errors.rs b/src/test/rustdoc-ui/intra-doc/errors.rs similarity index 100% rename from src/test/rustdoc-ui/intra-link-errors.rs rename to src/test/rustdoc-ui/intra-doc/errors.rs diff --git a/src/test/rustdoc-ui/intra-link-errors.stderr b/src/test/rustdoc-ui/intra-doc/errors.stderr similarity index 83% rename from src/test/rustdoc-ui/intra-link-errors.stderr rename to src/test/rustdoc-ui/intra-doc/errors.stderr index be98cac94ece7..21c806108e3af 100644 --- a/src/test/rustdoc-ui/intra-link-errors.stderr +++ b/src/test/rustdoc-ui/intra-doc/errors.stderr @@ -1,95 +1,95 @@ error: unresolved link to `path::to::nonexistent::module` - --> $DIR/intra-link-errors.rs:7:6 + --> $DIR/errors.rs:7:6 | LL | /// [path::to::nonexistent::module] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no item named `path` in scope | note: the lint level is defined here - --> $DIR/intra-link-errors.rs:1:9 + --> $DIR/errors.rs:1:9 | LL | #![deny(broken_intra_doc_links)] | ^^^^^^^^^^^^^^^^^^^^^^ error: unresolved link to `path::to::nonexistent::macro` - --> $DIR/intra-link-errors.rs:11:6 + --> $DIR/errors.rs:11:6 | LL | /// [path::to::nonexistent::macro!] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no item named `path` in scope error: unresolved link to `path::to::nonexistent::type` - --> $DIR/intra-link-errors.rs:15:6 + --> $DIR/errors.rs:15:6 | LL | /// [type@path::to::nonexistent::type] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no item named `path` in scope error: unresolved link to `std::io::not::here` - --> $DIR/intra-link-errors.rs:19:6 + --> $DIR/errors.rs:19:6 | LL | /// [std::io::not::here] | ^^^^^^^^^^^^^^^^^^ no item named `not` in module `io` error: unresolved link to `std::io::not::here` - --> $DIR/intra-link-errors.rs:23:6 + --> $DIR/errors.rs:23:6 | LL | /// [type@std::io::not::here] | ^^^^^^^^^^^^^^^^^^^^^^^ no item named `not` in module `io` error: unresolved link to `std::io::Error::x` - --> $DIR/intra-link-errors.rs:27:6 + --> $DIR/errors.rs:27:6 | LL | /// [std::io::Error::x] | ^^^^^^^^^^^^^^^^^ the struct `Error` has no field or associated item named `x` error: unresolved link to `std::io::ErrorKind::x` - --> $DIR/intra-link-errors.rs:31:6 + --> $DIR/errors.rs:31:6 | LL | /// [std::io::ErrorKind::x] | ^^^^^^^^^^^^^^^^^^^^^ the enum `ErrorKind` has no variant or associated item named `x` error: unresolved link to `f::A` - --> $DIR/intra-link-errors.rs:35:6 + --> $DIR/errors.rs:35:6 | LL | /// [f::A] | ^^^^ `f` is a function, not a module or type, and cannot have associated items error: unresolved link to `f::A` - --> $DIR/intra-link-errors.rs:39:6 + --> $DIR/errors.rs:39:6 | LL | /// [f::A!] | ^^^^^ `f` is a function, not a module or type, and cannot have associated items error: unresolved link to `S::A` - --> $DIR/intra-link-errors.rs:43:6 + --> $DIR/errors.rs:43:6 | LL | /// [S::A] | ^^^^ the struct `S` has no field or associated item named `A` error: unresolved link to `S::fmt` - --> $DIR/intra-link-errors.rs:47:6 + --> $DIR/errors.rs:47:6 | LL | /// [S::fmt] | ^^^^^^ the struct `S` has no field or associated item named `fmt` error: unresolved link to `E::D` - --> $DIR/intra-link-errors.rs:51:6 + --> $DIR/errors.rs:51:6 | LL | /// [E::D] | ^^^^ the enum `E` has no variant or associated item named `D` error: unresolved link to `u8::not_found` - --> $DIR/intra-link-errors.rs:55:6 + --> $DIR/errors.rs:55:6 | LL | /// [u8::not_found] | ^^^^^^^^^^^^^ the builtin type `u8` has no associated item named `not_found` error: unresolved link to `std::primitive::u8::not_found` - --> $DIR/intra-link-errors.rs:59:6 + --> $DIR/errors.rs:59:6 | LL | /// [std::primitive::u8::not_found] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the builtin type `u8` has no associated item named `not_found` error: unresolved link to `Vec::into_iter` - --> $DIR/intra-link-errors.rs:63:6 + --> $DIR/errors.rs:63:6 | LL | /// [type@Vec::into_iter] | ^^^^^^^^^^^^^^^^^^^ @@ -98,7 +98,7 @@ LL | /// [type@Vec::into_iter] | help: to link to the associated function, add parentheses: `Vec::into_iter()` error: unresolved link to `S` - --> $DIR/intra-link-errors.rs:68:6 + --> $DIR/errors.rs:68:6 | LL | /// [S!] | ^^ @@ -107,7 +107,7 @@ LL | /// [S!] | help: to link to the struct, prefix with `struct@`: `struct@S` error: unresolved link to `S::h` - --> $DIR/intra-link-errors.rs:78:6 + --> $DIR/errors.rs:78:6 | LL | /// [type@S::h] | ^^^^^^^^^ @@ -116,7 +116,7 @@ LL | /// [type@S::h] | help: to link to the associated function, add parentheses: `S::h()` error: unresolved link to `T::g` - --> $DIR/intra-link-errors.rs:86:6 + --> $DIR/errors.rs:86:6 | LL | /// [type@T::g] | ^^^^^^^^^ @@ -125,13 +125,13 @@ LL | /// [type@T::g] | help: to link to the associated function, add parentheses: `T::g()` error: unresolved link to `T::h` - --> $DIR/intra-link-errors.rs:91:6 + --> $DIR/errors.rs:91:6 | LL | /// [T::h!] | ^^^^^ the trait `T` has no macro named `h` error: unresolved link to `m` - --> $DIR/intra-link-errors.rs:98:6 + --> $DIR/errors.rs:98:6 | LL | /// [m()] | ^^^ diff --git a/src/test/rustdoc-ui/intra-link-malformed-generics.rs b/src/test/rustdoc-ui/intra-doc/malformed-generics.rs similarity index 100% rename from src/test/rustdoc-ui/intra-link-malformed-generics.rs rename to src/test/rustdoc-ui/intra-doc/malformed-generics.rs diff --git a/src/test/rustdoc-ui/intra-link-malformed-generics.stderr b/src/test/rustdoc-ui/intra-doc/malformed-generics.stderr similarity index 73% rename from src/test/rustdoc-ui/intra-link-malformed-generics.stderr rename to src/test/rustdoc-ui/intra-doc/malformed-generics.stderr index fe5d4cd1bbffa..2e1b22807bc39 100644 --- a/src/test/rustdoc-ui/intra-link-malformed-generics.stderr +++ b/src/test/rustdoc-ui/intra-doc/malformed-generics.stderr @@ -1,89 +1,89 @@ error: unresolved link to `Vec<` - --> $DIR/intra-link-malformed-generics.rs:3:6 + --> $DIR/malformed-generics.rs:3:6 | LL | //! [Vec<] | ^^^^ unbalanced angle brackets | note: the lint level is defined here - --> $DIR/intra-link-malformed-generics.rs:1:9 + --> $DIR/malformed-generics.rs:1:9 | LL | #![deny(broken_intra_doc_links)] | ^^^^^^^^^^^^^^^^^^^^^^ error: unresolved link to `Vec $DIR/intra-link-malformed-generics.rs:4:6 + --> $DIR/malformed-generics.rs:4:6 | LL | //! [Vec` - --> $DIR/intra-link-malformed-generics.rs:5:6 + --> $DIR/malformed-generics.rs:5:6 | LL | //! [Vec] | ^^^^^^^^^^ unbalanced angle brackets error: unresolved link to `Vec>>` - --> $DIR/intra-link-malformed-generics.rs:6:6 + --> $DIR/malformed-generics.rs:6:6 | LL | //! [Vec>>] | ^^^^^^^^^^^^ unbalanced angle brackets error: unresolved link to `Vec>>` - --> $DIR/intra-link-malformed-generics.rs:7:6 + --> $DIR/malformed-generics.rs:7:6 | LL | //! [Vec>>] | ^^^^^^^^ unbalanced angle brackets error: unresolved link to ` $DIR/intra-link-malformed-generics.rs:8:6 + --> $DIR/malformed-generics.rs:8:6 | LL | //! [ $DIR/intra-link-malformed-generics.rs:9:6 + --> $DIR/malformed-generics.rs:9:6 | LL | //! [Vec::<] | ^^^^^^ unbalanced angle brackets error: unresolved link to `` - --> $DIR/intra-link-malformed-generics.rs:10:6 + --> $DIR/malformed-generics.rs:10:6 | LL | //! [] | ^^^ missing type for generic parameters error: unresolved link to `` - --> $DIR/intra-link-malformed-generics.rs:11:6 + --> $DIR/malformed-generics.rs:11:6 | LL | //! [] | ^^^^^^^^^^^^^^^^ missing type for generic parameters error: unresolved link to `Vec::new` - --> $DIR/intra-link-malformed-generics.rs:12:6 + --> $DIR/malformed-generics.rs:12:6 | LL | //! [Vec::new()] | ^^^^^^^^^^^^^ has invalid path separator error: unresolved link to `Vec<>` - --> $DIR/intra-link-malformed-generics.rs:13:6 + --> $DIR/malformed-generics.rs:13:6 | LL | //! [Vec<>] | ^^^^^^^^ too many angle brackets error: unresolved link to `Vec<>` - --> $DIR/intra-link-malformed-generics.rs:14:6 + --> $DIR/malformed-generics.rs:14:6 | LL | //! [Vec<>] | ^^^^^ empty angle brackets error: unresolved link to `Vec<<>>` - --> $DIR/intra-link-malformed-generics.rs:15:6 + --> $DIR/malformed-generics.rs:15:6 | LL | //! [Vec<<>>] | ^^^^^^^ too many angle brackets error: unresolved link to `::into_iter` - --> $DIR/intra-link-malformed-generics.rs:18:6 + --> $DIR/malformed-generics.rs:18:6 | LL | //! [::into_iter] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ fully-qualified syntax is unsupported @@ -91,7 +91,7 @@ LL | //! [::into_iter] = note: see https://github.com/rust-lang/rust/issues/74563 for more information error: unresolved link to ` as IntoIterator>::iter` - --> $DIR/intra-link-malformed-generics.rs:19:6 + --> $DIR/malformed-generics.rs:19:6 | LL | //! [ as IntoIterator>::iter] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ fully-qualified syntax is unsupported diff --git a/src/test/rustdoc-ui/intra-link-prim-conflict.rs b/src/test/rustdoc-ui/intra-doc/prim-conflict.rs similarity index 100% rename from src/test/rustdoc-ui/intra-link-prim-conflict.rs rename to src/test/rustdoc-ui/intra-doc/prim-conflict.rs diff --git a/src/test/rustdoc-ui/intra-link-prim-conflict.stderr b/src/test/rustdoc-ui/intra-doc/prim-conflict.stderr similarity index 84% rename from src/test/rustdoc-ui/intra-link-prim-conflict.stderr rename to src/test/rustdoc-ui/intra-doc/prim-conflict.stderr index 43587a80021af..01275f8d9afb0 100644 --- a/src/test/rustdoc-ui/intra-link-prim-conflict.stderr +++ b/src/test/rustdoc-ui/intra-doc/prim-conflict.stderr @@ -1,11 +1,11 @@ error: `char` is both a module and a builtin type - --> $DIR/intra-link-prim-conflict.rs:4:6 + --> $DIR/prim-conflict.rs:4:6 | LL | /// [char] | ^^^^ ambiguous link | note: the lint level is defined here - --> $DIR/intra-link-prim-conflict.rs:1:9 + --> $DIR/prim-conflict.rs:1:9 | LL | #![deny(broken_intra_doc_links)] | ^^^^^^^^^^^^^^^^^^^^^^ @@ -19,7 +19,7 @@ LL | /// [prim@char] | ^^^^^^^^^ error: `char` is both a module and a builtin type - --> $DIR/intra-link-prim-conflict.rs:10:6 + --> $DIR/prim-conflict.rs:10:6 | LL | /// [type@char] | ^^^^^^^^^ ambiguous link @@ -34,7 +34,7 @@ LL | /// [prim@char] | ^^^^^^^^^ error: incompatible link kind for `char` - --> $DIR/intra-link-prim-conflict.rs:19:6 + --> $DIR/prim-conflict.rs:19:6 | LL | /// [struct@char] | ^^^^^^^^^^^ help: to link to the module, prefix with `mod@`: `mod@char` @@ -42,7 +42,7 @@ LL | /// [struct@char] = note: this link resolved to a module, which is not a struct error: incompatible link kind for `char` - --> $DIR/intra-link-prim-conflict.rs:26:10 + --> $DIR/prim-conflict.rs:26:10 | LL | //! [struct@char] | ^^^^^^^^^^^ help: to link to the builtin type, prefix with `prim@`: `prim@char` diff --git a/src/test/rustdoc-ui/intra-links-private.private.stderr b/src/test/rustdoc-ui/intra-doc/private.private.stderr similarity index 90% rename from src/test/rustdoc-ui/intra-links-private.private.stderr rename to src/test/rustdoc-ui/intra-doc/private.private.stderr index eeef24b479747..6e11ec3e87bf9 100644 --- a/src/test/rustdoc-ui/intra-links-private.private.stderr +++ b/src/test/rustdoc-ui/intra-doc/private.private.stderr @@ -1,5 +1,5 @@ warning: public documentation for `DocMe` links to private item `DontDocMe` - --> $DIR/intra-links-private.rs:5:11 + --> $DIR/private.rs:5:11 | LL | /// docs [DontDocMe] | ^^^^^^^^^ this item is private diff --git a/src/test/rustdoc-ui/intra-links-private.public.stderr b/src/test/rustdoc-ui/intra-doc/private.public.stderr similarity index 89% rename from src/test/rustdoc-ui/intra-links-private.public.stderr rename to src/test/rustdoc-ui/intra-doc/private.public.stderr index 3f7b17586f19e..3a6a4b664522a 100644 --- a/src/test/rustdoc-ui/intra-links-private.public.stderr +++ b/src/test/rustdoc-ui/intra-doc/private.public.stderr @@ -1,5 +1,5 @@ warning: public documentation for `DocMe` links to private item `DontDocMe` - --> $DIR/intra-links-private.rs:5:11 + --> $DIR/private.rs:5:11 | LL | /// docs [DontDocMe] | ^^^^^^^^^ this item is private diff --git a/src/test/rustdoc-ui/intra-links-private.rs b/src/test/rustdoc-ui/intra-doc/private.rs similarity index 100% rename from src/test/rustdoc-ui/intra-links-private.rs rename to src/test/rustdoc-ui/intra-doc/private.rs diff --git a/src/test/rustdoc-ui/intra-link-span-ice-55723.rs b/src/test/rustdoc-ui/intra-doc/span-ice-55723.rs similarity index 100% rename from src/test/rustdoc-ui/intra-link-span-ice-55723.rs rename to src/test/rustdoc-ui/intra-doc/span-ice-55723.rs diff --git a/src/test/rustdoc-ui/intra-link-span-ice-55723.stderr b/src/test/rustdoc-ui/intra-doc/span-ice-55723.stderr similarity index 79% rename from src/test/rustdoc-ui/intra-link-span-ice-55723.stderr rename to src/test/rustdoc-ui/intra-doc/span-ice-55723.stderr index d8afa9e7efd59..10ca14e850fd7 100644 --- a/src/test/rustdoc-ui/intra-link-span-ice-55723.stderr +++ b/src/test/rustdoc-ui/intra-doc/span-ice-55723.stderr @@ -1,11 +1,11 @@ error: unresolved link to `i` - --> $DIR/intra-link-span-ice-55723.rs:9:10 + --> $DIR/span-ice-55723.rs:9:10 | LL | /// (arr[i]) | ^ no item named `i` in scope | note: the lint level is defined here - --> $DIR/intra-link-span-ice-55723.rs:1:9 + --> $DIR/span-ice-55723.rs:1:9 | LL | #![deny(broken_intra_doc_links)] | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/rustdoc-ui/intra-links-warning-crlf.rs b/src/test/rustdoc-ui/intra-doc/warning-crlf.rs similarity index 100% rename from src/test/rustdoc-ui/intra-links-warning-crlf.rs rename to src/test/rustdoc-ui/intra-doc/warning-crlf.rs diff --git a/src/test/rustdoc-ui/intra-links-warning-crlf.stderr b/src/test/rustdoc-ui/intra-doc/warning-crlf.stderr similarity index 83% rename from src/test/rustdoc-ui/intra-links-warning-crlf.stderr rename to src/test/rustdoc-ui/intra-doc/warning-crlf.stderr index 67c48378fd2f4..01e4282003766 100644 --- a/src/test/rustdoc-ui/intra-links-warning-crlf.stderr +++ b/src/test/rustdoc-ui/intra-doc/warning-crlf.stderr @@ -1,5 +1,5 @@ warning: unresolved link to `error` - --> $DIR/intra-links-warning-crlf.rs:7:6 + --> $DIR/warning-crlf.rs:7:6 | LL | /// [error] | ^^^^^ no item named `error` in scope @@ -8,7 +8,7 @@ LL | /// [error] = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` warning: unresolved link to `error1` - --> $DIR/intra-links-warning-crlf.rs:12:11 + --> $DIR/warning-crlf.rs:12:11 | LL | /// docs [error1] | ^^^^^^ no item named `error1` in scope @@ -16,7 +16,7 @@ LL | /// docs [error1] = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` warning: unresolved link to `error2` - --> $DIR/intra-links-warning-crlf.rs:15:11 + --> $DIR/warning-crlf.rs:15:11 | LL | /// docs [error2] | ^^^^^^ no item named `error2` in scope @@ -24,7 +24,7 @@ LL | /// docs [error2] = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` warning: unresolved link to `error` - --> $DIR/intra-links-warning-crlf.rs:23:20 + --> $DIR/warning-crlf.rs:23:20 | LL | * It also has an [error]. | ^^^^^ no item named `error` in scope diff --git a/src/test/rustdoc-ui/intra-links-warning.rs b/src/test/rustdoc-ui/intra-doc/warning.rs similarity index 100% rename from src/test/rustdoc-ui/intra-links-warning.rs rename to src/test/rustdoc-ui/intra-doc/warning.rs diff --git a/src/test/rustdoc-ui/intra-links-warning.stderr b/src/test/rustdoc-ui/intra-doc/warning.stderr similarity index 86% rename from src/test/rustdoc-ui/intra-links-warning.stderr rename to src/test/rustdoc-ui/intra-doc/warning.stderr index 0b074e9d53e3d..430d18165a005 100644 --- a/src/test/rustdoc-ui/intra-links-warning.stderr +++ b/src/test/rustdoc-ui/intra-doc/warning.stderr @@ -1,5 +1,5 @@ warning: unresolved link to `Foo::baz` - --> $DIR/intra-links-warning.rs:3:23 + --> $DIR/warning.rs:3:23 | LL | //! Test with [Foo::baz], [Bar::foo], ... | ^^^^^^^^ the struct `Foo` has no field or associated item named `baz` @@ -7,37 +7,37 @@ LL | //! Test with [Foo::baz], [Bar::foo], ... = note: `#[warn(broken_intra_doc_links)]` on by default warning: unresolved link to `Bar::foo` - --> $DIR/intra-links-warning.rs:3:35 + --> $DIR/warning.rs:3:35 | LL | //! Test with [Foo::baz], [Bar::foo], ... | ^^^^^^^^ no item named `Bar` in scope warning: unresolved link to `Uniooon::X` - --> $DIR/intra-links-warning.rs:6:13 + --> $DIR/warning.rs:6:13 | LL | //! , [Uniooon::X] and [Qux::Z]. | ^^^^^^^^^^ no item named `Uniooon` in scope warning: unresolved link to `Qux::Z` - --> $DIR/intra-links-warning.rs:6:30 + --> $DIR/warning.rs:6:30 | LL | //! , [Uniooon::X] and [Qux::Z]. | ^^^^^^ no item named `Qux` in scope warning: unresolved link to `Uniooon::X` - --> $DIR/intra-links-warning.rs:10:14 + --> $DIR/warning.rs:10:14 | LL | //! , [Uniooon::X] and [Qux::Z]. | ^^^^^^^^^^ no item named `Uniooon` in scope warning: unresolved link to `Qux::Z` - --> $DIR/intra-links-warning.rs:10:31 + --> $DIR/warning.rs:10:31 | LL | //! , [Uniooon::X] and [Qux::Z]. | ^^^^^^ no item named `Qux` in scope warning: unresolved link to `Qux:Y` - --> $DIR/intra-links-warning.rs:14:13 + --> $DIR/warning.rs:14:13 | LL | /// [Qux:Y] | ^^^^^ no item named `Qux:Y` in scope @@ -45,7 +45,7 @@ LL | /// [Qux:Y] = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` warning: unresolved link to `BarA` - --> $DIR/intra-links-warning.rs:21:10 + --> $DIR/warning.rs:21:10 | LL | /// bar [BarA] bar | ^^^^ no item named `BarA` in scope @@ -53,7 +53,7 @@ LL | /// bar [BarA] bar = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` warning: unresolved link to `BarB` - --> $DIR/intra-links-warning.rs:27:9 + --> $DIR/warning.rs:27:9 | LL | * bar [BarB] bar | ^^^^ no item named `BarB` in scope @@ -61,7 +61,7 @@ LL | * bar [BarB] bar = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` warning: unresolved link to `BarC` - --> $DIR/intra-links-warning.rs:34:6 + --> $DIR/warning.rs:34:6 | LL | bar [BarC] bar | ^^^^ no item named `BarC` in scope @@ -69,7 +69,7 @@ LL | bar [BarC] bar = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` warning: unresolved link to `BarD` - --> $DIR/intra-links-warning.rs:45:1 + --> $DIR/warning.rs:45:1 | LL | #[doc = "Foo\nbar [BarD] bar\nbaz"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -82,7 +82,7 @@ LL | #[doc = "Foo\nbar [BarD] bar\nbaz"] = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` warning: unresolved link to `BarF` - --> $DIR/intra-links-warning.rs:50:9 + --> $DIR/warning.rs:50:9 | LL | #[doc = $f] | ^^^^^^^^^^^ @@ -99,7 +99,7 @@ LL | f!("Foo\nbar [BarF] bar\nbaz"); = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) warning: unresolved link to `error` - --> $DIR/intra-links-warning.rs:58:30 + --> $DIR/warning.rs:58:30 | LL | * time to introduce a link [error]*/ | ^^^^^ no item named `error` in scope @@ -107,7 +107,7 @@ LL | * time to introduce a link [error]*/ = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` warning: unresolved link to `error` - --> $DIR/intra-links-warning.rs:64:30 + --> $DIR/warning.rs:64:30 | LL | * time to introduce a link [error] | ^^^^^ no item named `error` in scope @@ -115,7 +115,7 @@ LL | * time to introduce a link [error] = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` warning: unresolved link to `error` - --> $DIR/intra-links-warning.rs:68:1 + --> $DIR/warning.rs:68:1 | LL | #[doc = "single line [error]"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -128,7 +128,7 @@ LL | #[doc = "single line [error]"] = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` warning: unresolved link to `error` - --> $DIR/intra-links-warning.rs:71:1 + --> $DIR/warning.rs:71:1 | LL | #[doc = "single line with \"escaping\" [error]"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -141,7 +141,7 @@ LL | #[doc = "single line with \"escaping\" [error]"] = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` warning: unresolved link to `error` - --> $DIR/intra-links-warning.rs:74:1 + --> $DIR/warning.rs:74:1 | LL | / /// Item docs. LL | | #[doc="Hello there!"] @@ -156,7 +156,7 @@ LL | | /// [error] = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` warning: unresolved link to `error1` - --> $DIR/intra-links-warning.rs:80:11 + --> $DIR/warning.rs:80:11 | LL | /// docs [error1] | ^^^^^^ no item named `error1` in scope @@ -164,7 +164,7 @@ LL | /// docs [error1] = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` warning: unresolved link to `error2` - --> $DIR/intra-links-warning.rs:82:11 + --> $DIR/warning.rs:82:11 | LL | /// docs [error2] | ^^^^^^ no item named `error2` in scope diff --git a/src/test/rustdoc/intra-doc-link-mod-ambiguity.rs b/src/test/rustdoc/intra-doc-link-mod-ambiguity.rs deleted file mode 100644 index bd733e1023033..0000000000000 --- a/src/test/rustdoc/intra-doc-link-mod-ambiguity.rs +++ /dev/null @@ -1,18 +0,0 @@ -// ignore-tidy-linelength - -#![deny(broken_intra_doc_links)] - - -pub fn foo() { - -} - -pub mod foo {} -// @has intra_doc_link_mod_ambiguity/struct.A.html '//a/@href' '../intra_doc_link_mod_ambiguity/foo/index.html' -/// Module is [`module@foo`] -pub struct A; - - -// @has intra_doc_link_mod_ambiguity/struct.B.html '//a/@href' '../intra_doc_link_mod_ambiguity/fn.foo.html' -/// Function is [`fn@foo`] -pub struct B; diff --git a/src/test/rustdoc/intra-links-anchors.rs b/src/test/rustdoc/intra-doc/anchors.rs similarity index 50% rename from src/test/rustdoc/intra-links-anchors.rs rename to src/test/rustdoc/intra-doc/anchors.rs index f554e16b4f475..e4f0c737bdd33 100644 --- a/src/test/rustdoc/intra-links-anchors.rs +++ b/src/test/rustdoc/intra-doc/anchors.rs @@ -3,8 +3,8 @@ /// # Anchor! pub struct Something; -// @has intra_links_anchors/struct.SomeOtherType.html -// @has - '//a/@href' '../intra_links_anchors/struct.Something.html#Anchor!' +// @has anchors/struct.SomeOtherType.html +// @has - '//a/@href' '../anchors/struct.Something.html#Anchor!' /// I want... /// diff --git a/src/test/rustdoc/intra-doc/associated-defaults.rs b/src/test/rustdoc/intra-doc/associated-defaults.rs new file mode 100644 index 0000000000000..f99d9b5baea44 --- /dev/null +++ b/src/test/rustdoc/intra-doc/associated-defaults.rs @@ -0,0 +1,27 @@ +// ignore-tidy-linelength +#![deny(intra_doc_link_resolution_failure)] +#![feature(associated_type_defaults)] + +pub trait TraitWithDefault { + type T = usize; + fn f() -> Self::T { + 0 + } +} + +/// Link to [UsesDefaults::T] and [UsesDefaults::f] +// @has 'associated_defaults/struct.UsesDefaults.html' '//a[@href="../associated_defaults/struct.UsesDefaults.html#associatedtype.T"]' 'UsesDefaults::T' +// @has 'associated_defaults/struct.UsesDefaults.html' '//a[@href="../associated_defaults/struct.UsesDefaults.html#method.f"]' 'UsesDefaults::f' +pub struct UsesDefaults; +impl TraitWithDefault for UsesDefaults {} + +/// Link to [OverridesDefaults::T] and [OverridesDefaults::f] +// @has 'associated_defaults/struct.OverridesDefaults.html' '//a[@href="../associated_defaults/struct.OverridesDefaults.html#associatedtype.T"]' 'OverridesDefaults::T' +// @has 'associated_defaults/struct.OverridesDefaults.html' '//a[@href="../associated_defaults/struct.OverridesDefaults.html#method.f"]' 'OverridesDefaults::f' +pub struct OverridesDefaults; +impl TraitWithDefault for OverridesDefaults { + type T = bool; + fn f() -> bool { + true + } +} diff --git a/src/test/rustdoc/intra-doc/associated-items.rs b/src/test/rustdoc/intra-doc/associated-items.rs new file mode 100644 index 0000000000000..09dfbfcf68a32 --- /dev/null +++ b/src/test/rustdoc/intra-doc/associated-items.rs @@ -0,0 +1,61 @@ +// ignore-tidy-linelength +#![deny(intra_doc_link_resolution_failure)] + +/// [`std::collections::BTreeMap::into_iter`] +/// [`String::from`] is ambiguous as to which `From` impl +/// [Vec::into_iter()] uses a disambiguator +// @has 'associated_items/fn.foo.html' '//a[@href="https://doc.rust-lang.org/nightly/alloc/collections/btree/map/struct.BTreeMap.html#method.into_iter"]' 'std::collections::BTreeMap::into_iter' +// @has 'associated_items/fn.foo.html' '//a[@href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html#method.from"]' 'String::from' +// @has 'associated_items/fn.foo.html' '//a[@href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html#method.into_iter"]' 'Vec::into_iter' +pub fn foo() {} + +/// Link to [MyStruct], [link from struct][MyStruct::method], [MyStruct::clone], [MyStruct::Input] +// @has 'associated_items/struct.MyStruct.html' '//a[@href="../associated_items/struct.MyStruct.html"]' 'MyStruct' +// @has 'associated_items/struct.MyStruct.html' '//a[@href="../associated_items/struct.MyStruct.html#method.method"]' 'link from struct' +// @has 'associated_items/struct.MyStruct.html' '//a[@href="../associated_items/struct.MyStruct.html#method.clone"]' 'MyStruct::clone' +// @has 'associated_items/struct.MyStruct.html' '//a[@href="../associated_items/struct.MyStruct.html#associatedtype.Input"]' 'MyStruct::Input' +pub struct MyStruct { foo: () } + +impl Clone for MyStruct { + fn clone(&self) -> Self { + MyStruct + } +} + +pub trait T { + type Input; + fn method(i: Self::Input); +} + +impl T for MyStruct { + type Input = usize; + + /// [link from method][MyStruct::method] on method + // @has 'associated_items/struct.MyStruct.html' '//a[@href="../associated_items/struct.MyStruct.html#method.method"]' 'link from method' + fn method(i: usize) { + } +} + +/// Ambiguity between which trait to use +pub trait T1 { + fn ambiguous_method(); +} + +pub trait T2 { + fn ambiguous_method(); +} + +/// Link to [S::ambiguous_method] +// FIXME: there is no way to disambiguate these. +// Since we have `#[deny(intra_doc_failure)]`, we still know it was one or the other. +pub struct S; + +impl T1 for S { + fn ambiguous_method() {} +} + +impl T2 for S { + fn ambiguous_method() {} +} + +fn main() {} diff --git a/src/test/rustdoc/auxiliary/intra-link-extern-crate.rs b/src/test/rustdoc/intra-doc/auxiliary/intra-link-extern-crate.rs similarity index 100% rename from src/test/rustdoc/auxiliary/intra-link-extern-crate.rs rename to src/test/rustdoc/intra-doc/auxiliary/intra-link-extern-crate.rs diff --git a/src/test/rustdoc/auxiliary/intra-link-pub-use.rs b/src/test/rustdoc/intra-doc/auxiliary/intra-link-pub-use.rs similarity index 100% rename from src/test/rustdoc/auxiliary/intra-link-pub-use.rs rename to src/test/rustdoc/intra-doc/auxiliary/intra-link-pub-use.rs diff --git a/src/test/rustdoc/auxiliary/intra-link-reexport-additional-docs.rs b/src/test/rustdoc/intra-doc/auxiliary/intra-link-reexport-additional-docs.rs similarity index 100% rename from src/test/rustdoc/auxiliary/intra-link-reexport-additional-docs.rs rename to src/test/rustdoc/intra-doc/auxiliary/intra-link-reexport-additional-docs.rs diff --git a/src/test/rustdoc/auxiliary/intra-links-external-traits.rs b/src/test/rustdoc/intra-doc/auxiliary/intra-links-external-traits.rs similarity index 100% rename from src/test/rustdoc/auxiliary/intra-links-external-traits.rs rename to src/test/rustdoc/intra-doc/auxiliary/intra-links-external-traits.rs diff --git a/src/test/rustdoc/auxiliary/my-core.rs b/src/test/rustdoc/intra-doc/auxiliary/my-core.rs similarity index 100% rename from src/test/rustdoc/auxiliary/my-core.rs rename to src/test/rustdoc/intra-doc/auxiliary/my-core.rs diff --git a/src/test/rustdoc/auxiliary/intra-link-proc-macro-macro.rs b/src/test/rustdoc/intra-doc/auxiliary/proc-macro-macro.rs similarity index 93% rename from src/test/rustdoc/auxiliary/intra-link-proc-macro-macro.rs rename to src/test/rustdoc/intra-doc/auxiliary/proc-macro-macro.rs index 04a431d99026e..5ba132f25b471 100644 --- a/src/test/rustdoc/auxiliary/intra-link-proc-macro-macro.rs +++ b/src/test/rustdoc/intra-doc/auxiliary/proc-macro-macro.rs @@ -3,7 +3,6 @@ // compile-flags: --crate-type proc-macro #![crate_type="proc-macro"] -#![crate_name="intra_link_proc_macro_macro"] extern crate proc_macro; diff --git a/src/test/rustdoc/auxiliary/through-proc-macro-aux.rs b/src/test/rustdoc/intra-doc/auxiliary/through-proc-macro-aux.rs similarity index 100% rename from src/test/rustdoc/auxiliary/through-proc-macro-aux.rs rename to src/test/rustdoc/intra-doc/auxiliary/through-proc-macro-aux.rs diff --git a/src/test/rustdoc/intra-links.rs b/src/test/rustdoc/intra-doc/basic.rs similarity index 52% rename from src/test/rustdoc/intra-links.rs rename to src/test/rustdoc/intra-doc/basic.rs index 751c10925c017..7760546e1fa1c 100644 --- a/src/test/rustdoc/intra-links.rs +++ b/src/test/rustdoc/intra-doc/basic.rs @@ -1,21 +1,21 @@ -// @has intra_links/index.html -// @has - '//a/@href' '../intra_links/struct.ThisType.html' -// @has - '//a/@href' '../intra_links/struct.ThisType.html#method.this_method' -// @has - '//a/@href' '../intra_links/enum.ThisEnum.html' -// @has - '//a/@href' '../intra_links/enum.ThisEnum.html#variant.ThisVariant' -// @has - '//a/@href' '../intra_links/trait.ThisTrait.html' -// @has - '//a/@href' '../intra_links/trait.ThisTrait.html#tymethod.this_associated_method' -// @has - '//a/@href' '../intra_links/trait.ThisTrait.html#associatedtype.ThisAssociatedType' -// @has - '//a/@href' '../intra_links/trait.ThisTrait.html#associatedconstant.THIS_ASSOCIATED_CONST' -// @has - '//a/@href' '../intra_links/trait.ThisTrait.html' -// @has - '//a/@href' '../intra_links/type.ThisAlias.html' -// @has - '//a/@href' '../intra_links/union.ThisUnion.html' -// @has - '//a/@href' '../intra_links/fn.this_function.html' -// @has - '//a/@href' '../intra_links/constant.THIS_CONST.html' -// @has - '//a/@href' '../intra_links/static.THIS_STATIC.html' -// @has - '//a/@href' '../intra_links/macro.this_macro.html' -// @has - '//a/@href' '../intra_links/trait.SoAmbiguous.html' -// @has - '//a/@href' '../intra_links/fn.SoAmbiguous.html' +// @has basic/index.html +// @has - '//a/@href' '../basic/struct.ThisType.html' +// @has - '//a/@href' '../basic/struct.ThisType.html#method.this_method' +// @has - '//a/@href' '../basic/enum.ThisEnum.html' +// @has - '//a/@href' '../basic/enum.ThisEnum.html#variant.ThisVariant' +// @has - '//a/@href' '../basic/trait.ThisTrait.html' +// @has - '//a/@href' '../basic/trait.ThisTrait.html#tymethod.this_associated_method' +// @has - '//a/@href' '../basic/trait.ThisTrait.html#associatedtype.ThisAssociatedType' +// @has - '//a/@href' '../basic/trait.ThisTrait.html#associatedconstant.THIS_ASSOCIATED_CONST' +// @has - '//a/@href' '../basic/trait.ThisTrait.html' +// @has - '//a/@href' '../basic/type.ThisAlias.html' +// @has - '//a/@href' '../basic/union.ThisUnion.html' +// @has - '//a/@href' '../basic/fn.this_function.html' +// @has - '//a/@href' '../basic/constant.THIS_CONST.html' +// @has - '//a/@href' '../basic/static.THIS_STATIC.html' +// @has - '//a/@href' '../basic/macro.this_macro.html' +// @has - '//a/@href' '../basic/trait.SoAmbiguous.html' +// @has - '//a/@href' '../basic/fn.SoAmbiguous.html' //! In this crate we would like to link to: //! //! * [`ThisType`](ThisType) @@ -46,7 +46,7 @@ macro_rules! this_macro { () => {}; } -// @has intra_links/struct.ThisType.html '//a/@href' '../intra_links/macro.this_macro.html' +// @has basic/struct.ThisType.html '//a/@href' '../basic/macro.this_macro.html' /// another link to [`this_macro!()`] pub struct ThisType; @@ -72,10 +72,10 @@ pub trait SoAmbiguous {} pub fn SoAmbiguous() {} -// @has intra_links/struct.SomeOtherType.html '//a/@href' '../intra_links/struct.ThisType.html' -// @has - '//a/@href' '../intra_links/struct.ThisType.html#method.this_method' -// @has - '//a/@href' '../intra_links/enum.ThisEnum.html' -// @has - '//a/@href' '../intra_links/enum.ThisEnum.html#variant.ThisVariant' +// @has basic/struct.SomeOtherType.html '//a/@href' '../basic/struct.ThisType.html' +// @has - '//a/@href' '../basic/struct.ThisType.html#method.this_method' +// @has - '//a/@href' '../basic/enum.ThisEnum.html' +// @has - '//a/@href' '../basic/enum.ThisEnum.html#variant.ThisVariant' /// Shortcut links for: /// * [`ThisType`] /// * [`ThisType::this_method`] diff --git a/src/test/rustdoc/intra-link-builtin-macros.rs b/src/test/rustdoc/intra-doc/builtin-macros.rs similarity index 66% rename from src/test/rustdoc/intra-link-builtin-macros.rs rename to src/test/rustdoc/intra-doc/builtin-macros.rs index 4d40eb3b88f1b..74216a587e1da 100644 --- a/src/test/rustdoc/intra-link-builtin-macros.rs +++ b/src/test/rustdoc/intra-doc/builtin-macros.rs @@ -1,3 +1,3 @@ -// @has intra_link_builtin_macros/index.html +// @has builtin_macros/index.html // @has - '//a/@href' 'https://doc.rust-lang.org/nightly/core/macro.cfg.html' //! [cfg] diff --git a/src/test/rustdoc/intra-doc-crate/additional_doc.rs b/src/test/rustdoc/intra-doc/cross-crate/additional_doc.rs similarity index 100% rename from src/test/rustdoc/intra-doc-crate/additional_doc.rs rename to src/test/rustdoc/intra-doc/cross-crate/additional_doc.rs diff --git a/src/test/rustdoc/intra-doc-crate/auxiliary/additional_doc.rs b/src/test/rustdoc/intra-doc/cross-crate/auxiliary/additional_doc.rs similarity index 100% rename from src/test/rustdoc/intra-doc-crate/auxiliary/additional_doc.rs rename to src/test/rustdoc/intra-doc/cross-crate/auxiliary/additional_doc.rs diff --git a/src/test/rustdoc/intra-doc-crate/auxiliary/hidden.rs b/src/test/rustdoc/intra-doc/cross-crate/auxiliary/hidden.rs similarity index 100% rename from src/test/rustdoc/intra-doc-crate/auxiliary/hidden.rs rename to src/test/rustdoc/intra-doc/cross-crate/auxiliary/hidden.rs diff --git a/src/test/rustdoc/intra-doc-crate/auxiliary/intra-doc-basic.rs b/src/test/rustdoc/intra-doc/cross-crate/auxiliary/intra-doc-basic.rs similarity index 100% rename from src/test/rustdoc/intra-doc-crate/auxiliary/intra-doc-basic.rs rename to src/test/rustdoc/intra-doc/cross-crate/auxiliary/intra-doc-basic.rs diff --git a/src/test/rustdoc/auxiliary/intra-link-cross-crate-crate.rs b/src/test/rustdoc/intra-doc/cross-crate/auxiliary/intra-link-cross-crate-crate.rs similarity index 100% rename from src/test/rustdoc/auxiliary/intra-link-cross-crate-crate.rs rename to src/test/rustdoc/intra-doc/cross-crate/auxiliary/intra-link-cross-crate-crate.rs diff --git a/src/test/rustdoc/intra-doc-crate/auxiliary/macro_inner.rs b/src/test/rustdoc/intra-doc/cross-crate/auxiliary/macro_inner.rs similarity index 100% rename from src/test/rustdoc/intra-doc-crate/auxiliary/macro_inner.rs rename to src/test/rustdoc/intra-doc/cross-crate/auxiliary/macro_inner.rs diff --git a/src/test/rustdoc/intra-doc-crate/auxiliary/module.rs b/src/test/rustdoc/intra-doc/cross-crate/auxiliary/module.rs similarity index 100% rename from src/test/rustdoc/intra-doc-crate/auxiliary/module.rs rename to src/test/rustdoc/intra-doc/cross-crate/auxiliary/module.rs diff --git a/src/test/rustdoc/intra-doc-crate/auxiliary/proc_macro.rs b/src/test/rustdoc/intra-doc/cross-crate/auxiliary/proc_macro.rs similarity index 100% rename from src/test/rustdoc/intra-doc-crate/auxiliary/proc_macro.rs rename to src/test/rustdoc/intra-doc/cross-crate/auxiliary/proc_macro.rs diff --git a/src/test/rustdoc/intra-doc-crate/auxiliary/submodule-inner.rs b/src/test/rustdoc/intra-doc/cross-crate/auxiliary/submodule-inner.rs similarity index 100% rename from src/test/rustdoc/intra-doc-crate/auxiliary/submodule-inner.rs rename to src/test/rustdoc/intra-doc/cross-crate/auxiliary/submodule-inner.rs diff --git a/src/test/rustdoc/intra-doc-crate/auxiliary/submodule-outer.rs b/src/test/rustdoc/intra-doc/cross-crate/auxiliary/submodule-outer.rs similarity index 100% rename from src/test/rustdoc/intra-doc-crate/auxiliary/submodule-outer.rs rename to src/test/rustdoc/intra-doc/cross-crate/auxiliary/submodule-outer.rs diff --git a/src/test/rustdoc/intra-doc-crate/auxiliary/traits.rs b/src/test/rustdoc/intra-doc/cross-crate/auxiliary/traits.rs similarity index 100% rename from src/test/rustdoc/intra-doc-crate/auxiliary/traits.rs rename to src/test/rustdoc/intra-doc/cross-crate/auxiliary/traits.rs diff --git a/src/test/rustdoc/intra-doc-crate/basic.rs b/src/test/rustdoc/intra-doc/cross-crate/basic.rs similarity index 100% rename from src/test/rustdoc/intra-doc-crate/basic.rs rename to src/test/rustdoc/intra-doc/cross-crate/basic.rs diff --git a/src/test/rustdoc/intra-link-cross-crate-crate.rs b/src/test/rustdoc/intra-doc/cross-crate/crate.rs similarity index 100% rename from src/test/rustdoc/intra-link-cross-crate-crate.rs rename to src/test/rustdoc/intra-doc/cross-crate/crate.rs diff --git a/src/test/rustdoc/intra-doc-crate/hidden.rs b/src/test/rustdoc/intra-doc/cross-crate/hidden.rs similarity index 100% rename from src/test/rustdoc/intra-doc-crate/hidden.rs rename to src/test/rustdoc/intra-doc/cross-crate/hidden.rs diff --git a/src/test/rustdoc/intra-doc-crate/macro.rs b/src/test/rustdoc/intra-doc/cross-crate/macro.rs similarity index 100% rename from src/test/rustdoc/intra-doc-crate/macro.rs rename to src/test/rustdoc/intra-doc/cross-crate/macro.rs diff --git a/src/test/rustdoc/intra-doc-crate/module.rs b/src/test/rustdoc/intra-doc/cross-crate/module.rs similarity index 100% rename from src/test/rustdoc/intra-doc-crate/module.rs rename to src/test/rustdoc/intra-doc/cross-crate/module.rs diff --git a/src/test/rustdoc/intra-doc-crate/submodule-inner.rs b/src/test/rustdoc/intra-doc/cross-crate/submodule-inner.rs similarity index 100% rename from src/test/rustdoc/intra-doc-crate/submodule-inner.rs rename to src/test/rustdoc/intra-doc/cross-crate/submodule-inner.rs diff --git a/src/test/rustdoc/intra-doc-crate/submodule-outer.rs b/src/test/rustdoc/intra-doc/cross-crate/submodule-outer.rs similarity index 100% rename from src/test/rustdoc/intra-doc-crate/submodule-outer.rs rename to src/test/rustdoc/intra-doc/cross-crate/submodule-outer.rs diff --git a/src/test/rustdoc/intra-doc-crate/traits.rs b/src/test/rustdoc/intra-doc/cross-crate/traits.rs similarity index 100% rename from src/test/rustdoc/intra-doc-crate/traits.rs rename to src/test/rustdoc/intra-doc/cross-crate/traits.rs diff --git a/src/test/rustdoc/intra-doc/disambiguators-removed.rs b/src/test/rustdoc/intra-doc/disambiguators-removed.rs new file mode 100644 index 0000000000000..aa0ced62aaf30 --- /dev/null +++ b/src/test/rustdoc/intra-doc/disambiguators-removed.rs @@ -0,0 +1,51 @@ +// ignore-tidy-linelength +#![deny(intra_doc_link_resolution_failure)] +// first try backticks +/// Trait: [`trait@Name`], fn: [`fn@Name`], [`Name`][`macro@Name`] +// @has disambiguators_removed/struct.AtDisambiguator.html +// @has - '//a[@href="../disambiguators_removed/trait.Name.html"][code]' "Name" +// @has - '//a[@href="../disambiguators_removed/fn.Name.html"][code]' "Name" +// @has - '//a[@href="../disambiguators_removed/macro.Name.html"][code]' "Name" +pub struct AtDisambiguator; + +/// fn: [`Name()`], macro: [`Name!`] +// @has disambiguators_removed/struct.SymbolDisambiguator.html +// @has - '//a[@href="../disambiguators_removed/fn.Name.html"][code]' "Name()" +// @has - '//a[@href="../disambiguators_removed/macro.Name.html"][code]' "Name!" +pub struct SymbolDisambiguator; + +// Now make sure that backticks aren't added if they weren't already there +/// [fn@Name] +// @has disambiguators_removed/trait.Name.html +// @has - '//a[@href="../disambiguators_removed/fn.Name.html"]' "Name" +// @!has - '//a[@href="../disambiguators_removed/fn.Name.html"][code]' "Name" + +// FIXME: this will turn !() into ! alone +/// [Name!()] +// @has - '//a[@href="../disambiguators_removed/macro.Name.html"]' "Name!" +pub trait Name {} + +#[allow(non_snake_case)] + +// Try collapsed reference links +/// [macro@Name][] +// @has disambiguators_removed/fn.Name.html +// @has - '//a[@href="../disambiguators_removed/macro.Name.html"]' "Name" + +// Try links that have the same text as a generated URL +/// Weird URL aligned [../disambiguators_removed/macro.Name.html][trait@Name] +// @has - '//a[@href="../disambiguators_removed/trait.Name.html"]' "../disambiguators_removed/macro.Name.html" +pub fn Name() {} + +#[macro_export] +// Rustdoc doesn't currently handle links that have weird interspersing of inline code blocks. +/// [fn@Na`m`e] +// @has disambiguators_removed/macro.Name.html +// @has - '//a[@href="../disambiguators_removed/fn.Name.html"]' "fn@Name" + +// It also doesn't handle any case where the code block isn't the whole link text: +/// [trait@`Name`] +// @has - '//a[@href="../disambiguators_removed/trait.Name.html"]' "trait@Name" +macro_rules! Name { + () => () +} diff --git a/src/test/rustdoc/intra-doc-link-enum-struct-field.rs b/src/test/rustdoc/intra-doc/enum-struct-field.rs similarity index 100% rename from src/test/rustdoc/intra-doc-link-enum-struct-field.rs rename to src/test/rustdoc/intra-doc/enum-struct-field.rs diff --git a/src/test/rustdoc/intra-link-extern-crate.rs b/src/test/rustdoc/intra-doc/extern-crate.rs similarity index 100% rename from src/test/rustdoc/intra-link-extern-crate.rs rename to src/test/rustdoc/intra-doc/extern-crate.rs diff --git a/src/test/rustdoc/intra-doc/extern-type.rs b/src/test/rustdoc/intra-doc/extern-type.rs new file mode 100644 index 0000000000000..e1934698d1fad --- /dev/null +++ b/src/test/rustdoc/intra-doc/extern-type.rs @@ -0,0 +1,17 @@ +#![feature(extern_types)] + +extern { + pub type ExternType; +} + +impl ExternType { + pub fn f(&self) { + + } +} + +// @has 'extern_type/foreigntype.ExternType.html' +// @has 'extern_type/fn.links_to_extern_type.html' \ +// 'href="../extern_type/foreigntype.ExternType.html#method.f"' +/// See also [ExternType::f] +pub fn links_to_extern_type() {} diff --git a/src/test/rustdoc/intra-links-external-traits.rs b/src/test/rustdoc/intra-doc/external-traits.rs similarity index 100% rename from src/test/rustdoc/intra-links-external-traits.rs rename to src/test/rustdoc/intra-doc/external-traits.rs diff --git a/src/test/rustdoc/intra-doc-link-generic-params.rs b/src/test/rustdoc/intra-doc/generic-params.rs similarity index 100% rename from src/test/rustdoc/intra-doc-link-generic-params.rs rename to src/test/rustdoc/intra-doc/generic-params.rs diff --git a/src/test/rustdoc/intra-link-in-bodies.rs b/src/test/rustdoc/intra-doc/in-bodies.rs similarity index 100% rename from src/test/rustdoc/intra-link-in-bodies.rs rename to src/test/rustdoc/intra-doc/in-bodies.rs diff --git a/src/test/rustdoc/intra-link-libstd-re-export.rs b/src/test/rustdoc/intra-doc/libstd-re-export.rs similarity index 100% rename from src/test/rustdoc/intra-link-libstd-re-export.rs rename to src/test/rustdoc/intra-doc/libstd-re-export.rs diff --git a/src/test/rustdoc/intra-doc/mod-ambiguity.rs b/src/test/rustdoc/intra-doc/mod-ambiguity.rs new file mode 100644 index 0000000000000..feb013b22be65 --- /dev/null +++ b/src/test/rustdoc/intra-doc/mod-ambiguity.rs @@ -0,0 +1,16 @@ +#![deny(broken_intra_doc_links)] + + +pub fn foo() { + +} + +pub mod foo {} +// @has mod_ambiguity/struct.A.html '//a/@href' '../mod_ambiguity/foo/index.html' +/// Module is [`module@foo`] +pub struct A; + + +// @has mod_ambiguity/struct.B.html '//a/@href' '../mod_ambiguity/fn.foo.html' +/// Function is [`fn@foo`] +pub struct B; diff --git a/src/test/rustdoc/intra-doc/prim-assoc.rs b/src/test/rustdoc/intra-doc/prim-assoc.rs new file mode 100644 index 0000000000000..d687cbd69bb18 --- /dev/null +++ b/src/test/rustdoc/intra-doc/prim-assoc.rs @@ -0,0 +1,5 @@ +// ignore-tidy-linelength +#![deny(broken_intra_doc_links)] + +//! [i32::MAX] +// @has prim_assoc/index.html '//a[@href="https://doc.rust-lang.org/nightly/std/primitive.i32.html#associatedconstant.MAX"]' "i32::MAX" diff --git a/src/test/rustdoc/intra-link-prim-methods-external-core.rs b/src/test/rustdoc/intra-doc/prim-methods-external-core.rs similarity index 90% rename from src/test/rustdoc/intra-link-prim-methods-external-core.rs rename to src/test/rustdoc/intra-doc/prim-methods-external-core.rs index c8ef4c015997b..434e03389835f 100644 --- a/src/test/rustdoc/intra-link-prim-methods-external-core.rs +++ b/src/test/rustdoc/intra-doc/prim-methods-external-core.rs @@ -9,7 +9,7 @@ #![no_core] #![crate_type = "rlib"] -// @has intra_link_prim_methods_external_core/index.html +// @has prim_methods_external_core/index.html // @has - '//*[@id="main"]//a[@href="https://doc.rust-lang.org/nightly/std/primitive.char.html"]' 'char' // @has - '//*[@id="main"]//a[@href="https://doc.rust-lang.org/nightly/std/primitive.char.html#method.len_utf8"]' 'char::len_utf8' diff --git a/src/test/rustdoc/intra-link-prim-methods-local.rs b/src/test/rustdoc/intra-doc/prim-methods-local.rs similarity index 92% rename from src/test/rustdoc/intra-link-prim-methods-local.rs rename to src/test/rustdoc/intra-doc/prim-methods-local.rs index d448acf7f9682..9888f29db5bac 100644 --- a/src/test/rustdoc/intra-link-prim-methods-local.rs +++ b/src/test/rustdoc/intra-doc/prim-methods-local.rs @@ -5,7 +5,7 @@ // ignore-tidy-linelength -// @has intra_link_prim_methods_local/index.html +// @has prim_methods_local/index.html // @has - '//*[@id="main"]//a[@href="https://doc.rust-lang.org/nightly/std/primitive.char.html"]' 'char' // @has - '//*[@id="main"]//a[@href="https://doc.rust-lang.org/nightly/std/primitive.char.html#method.len_utf8"]' 'char::len_utf8' diff --git a/src/test/rustdoc/intra-link-prim-methods.rs b/src/test/rustdoc/intra-doc/prim-methods.rs similarity index 88% rename from src/test/rustdoc/intra-link-prim-methods.rs rename to src/test/rustdoc/intra-doc/prim-methods.rs index 94c80c996c1e0..f19cff7d34afa 100644 --- a/src/test/rustdoc/intra-link-prim-methods.rs +++ b/src/test/rustdoc/intra-doc/prim-methods.rs @@ -2,7 +2,7 @@ // ignore-tidy-linelength -// @has intra_link_prim_methods/index.html +// @has prim_methods/index.html // @has - '//*[@id="main"]//a[@href="https://doc.rust-lang.org/nightly/std/primitive.char.html"]' 'char' // @has - '//*[@id="main"]//a[@href="https://doc.rust-lang.org/nightly/std/primitive.char.html#method.len_utf8"]' 'char::len_utf8' diff --git a/src/test/rustdoc/intra-doc/prim-precedence.rs b/src/test/rustdoc/intra-doc/prim-precedence.rs new file mode 100644 index 0000000000000..ed2c2cda7184d --- /dev/null +++ b/src/test/rustdoc/intra-doc/prim-precedence.rs @@ -0,0 +1,17 @@ +// ignore-tidy-linelength +#![deny(broken_intra_doc_links)] + +pub mod char { + /// [char] + // @has prim_precedence/char/struct.Inner.html '//a/@href' 'https://doc.rust-lang.org/nightly/std/primitive.char.html' + pub struct Inner; +} + +/// See [prim@char] +// @has prim_precedence/struct.MyString.html '//a/@href' 'https://doc.rust-lang.org/nightly/std/primitive.char.html' +pub struct MyString; + +/// See also [crate::char] and [mod@char] +// @has prim_precedence/struct.MyString2.html '//*[@href="../prim_precedence/char/index.html"]' 'crate::char' +// @has - '//*[@href="../prim_precedence/char/index.html"]' 'mod@char' +pub struct MyString2; diff --git a/src/test/rustdoc/intra-link-primitive-non-default-impl.rs b/src/test/rustdoc/intra-doc/primitive-non-default-impl.rs similarity index 88% rename from src/test/rustdoc/intra-link-primitive-non-default-impl.rs rename to src/test/rustdoc/intra-doc/primitive-non-default-impl.rs index 160b18a967b20..548eb090a3276 100644 --- a/src/test/rustdoc/intra-link-primitive-non-default-impl.rs +++ b/src/test/rustdoc/intra-doc/primitive-non-default-impl.rs @@ -2,7 +2,7 @@ // ignore-tidy-linelength -// @has intra_link_primitive_non_default_impl/fn.str_methods.html +// @has primitive_non_default_impl/fn.str_methods.html /// [`str::trim`] // @has - '//*[@href="https://doc.rust-lang.org/nightly/std/primitive.str.html#method.trim"]' 'str::trim' /// [`str::to_lowercase`] @@ -13,7 +13,7 @@ // @has - '//*[@href="https://doc.rust-lang.org/nightly/std/primitive.str.html#method.replace"]' 'str::replace' pub fn str_methods() {} -// @has intra_link_primitive_non_default_impl/fn.f32_methods.html +// @has primitive_non_default_impl/fn.f32_methods.html /// [f32::powi] // @has - '//*[@href="https://doc.rust-lang.org/nightly/std/primitive.f32.html#method.powi"]' 'f32::powi' /// [f32::sqrt] @@ -22,7 +22,7 @@ pub fn str_methods() {} // @has - '//*[@href="https://doc.rust-lang.org/nightly/std/primitive.f32.html#method.mul_add"]' 'f32::mul_add' pub fn f32_methods() {} -// @has intra_link_primitive_non_default_impl/fn.f64_methods.html +// @has primitive_non_default_impl/fn.f64_methods.html /// [`f64::powi`] // @has - '//*[@href="https://doc.rust-lang.org/nightly/std/primitive.f64.html#method.powi"]' 'f64::powi' /// [`f64::sqrt`] diff --git a/src/test/rustdoc/intra-link-private.rs b/src/test/rustdoc/intra-doc/private-failures-ignored.rs similarity index 100% rename from src/test/rustdoc/intra-link-private.rs rename to src/test/rustdoc/intra-doc/private-failures-ignored.rs diff --git a/src/test/rustdoc/intra-doc-link-private.rs b/src/test/rustdoc/intra-doc/private.rs similarity index 100% rename from src/test/rustdoc/intra-doc-link-private.rs rename to src/test/rustdoc/intra-doc/private.rs diff --git a/src/test/rustdoc/intra-doc/proc-macro.rs b/src/test/rustdoc/intra-doc/proc-macro.rs new file mode 100644 index 0000000000000..ab4626ccfc3ab --- /dev/null +++ b/src/test/rustdoc/intra-doc/proc-macro.rs @@ -0,0 +1,27 @@ +// aux-build:proc-macro-macro.rs +// build-aux-docs +#![deny(broken_intra_doc_links)] + +extern crate proc_macro_macro; + + +pub use proc_macro_macro::{DeriveA, attr_a}; +use proc_macro_macro::{DeriveB, attr_b}; + +// @has proc_macro/struct.Foo.html +// @has - '//a/@href' '../proc_macro/derive.DeriveA.html' +// @has - '//a/@href' '../proc_macro/attr.attr_a.html' +// @has - '//a/@href' '../proc_macro/trait.DeriveTrait.html' +// @has - '//a/@href' '../proc_macro_macro/derive.DeriveB.html' +// @has - '//a/@href' '../proc_macro_macro/attr.attr_b.html' +/// Link to [DeriveA], [attr_a], [DeriveB], [attr_b], [DeriveTrait] +pub struct Foo; + +// @has proc_macro/struct.Bar.html +// @has - '//a/@href' '../proc_macro/derive.DeriveA.html' +// @has - '//a/@href' '../proc_macro/attr.attr_a.html' +/// Link to [deriveA](derive@DeriveA) [attr](macro@attr_a) +pub struct Bar; + +// this should not cause ambiguity errors +pub trait DeriveTrait {} diff --git a/src/test/rustdoc/intra-link-pub-use.rs b/src/test/rustdoc/intra-doc/pub-use.rs similarity index 100% rename from src/test/rustdoc/intra-link-pub-use.rs rename to src/test/rustdoc/intra-doc/pub-use.rs diff --git a/src/test/rustdoc/intra-link-reexport-additional-docs.rs b/src/test/rustdoc/intra-doc/reexport-additional-docs.rs similarity index 100% rename from src/test/rustdoc/intra-link-reexport-additional-docs.rs rename to src/test/rustdoc/intra-doc/reexport-additional-docs.rs diff --git a/src/test/rustdoc/intra-link-self.rs b/src/test/rustdoc/intra-doc/self.rs similarity index 100% rename from src/test/rustdoc/intra-link-self.rs rename to src/test/rustdoc/intra-doc/self.rs diff --git a/src/test/rustdoc/through-proc-macro.rs b/src/test/rustdoc/intra-doc/through-proc-macro.rs similarity index 100% rename from src/test/rustdoc/through-proc-macro.rs rename to src/test/rustdoc/intra-doc/through-proc-macro.rs diff --git a/src/test/rustdoc/intra-link-trait-impl.rs b/src/test/rustdoc/intra-doc/trait-impl.rs similarity index 100% rename from src/test/rustdoc/intra-link-trait-impl.rs rename to src/test/rustdoc/intra-doc/trait-impl.rs diff --git a/src/test/rustdoc/intra-link-trait-item.rs b/src/test/rustdoc/intra-doc/trait-item.rs similarity index 69% rename from src/test/rustdoc/intra-link-trait-item.rs rename to src/test/rustdoc/intra-doc/trait-item.rs index 54270414c9dfe..de8585f4c9a78 100644 --- a/src/test/rustdoc/intra-link-trait-item.rs +++ b/src/test/rustdoc/intra-doc/trait-item.rs @@ -3,7 +3,7 @@ /// Link to [S::assoc_fn()] /// Link to [Default::default()] -// @has intra_link_trait_item/struct.S.html '//*[@href="../intra_link_trait_item/struct.S.html#method.assoc_fn"]' 'S::assoc_fn()' +// @has trait_item/struct.S.html '//*[@href="../trait_item/struct.S.html#method.assoc_fn"]' 'S::assoc_fn()' // @has - '//*[@href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default"]' 'Default::default()' pub struct S; diff --git a/src/test/rustdoc/intra-doc-link-true-false.rs b/src/test/rustdoc/intra-doc/true-false.rs similarity index 100% rename from src/test/rustdoc/intra-doc-link-true-false.rs rename to src/test/rustdoc/intra-doc/true-false.rs diff --git a/src/test/rustdoc/intra-link-associated-defaults.rs b/src/test/rustdoc/intra-link-associated-defaults.rs deleted file mode 100644 index 2051129b948f3..0000000000000 --- a/src/test/rustdoc/intra-link-associated-defaults.rs +++ /dev/null @@ -1,27 +0,0 @@ -// ignore-tidy-linelength -#![deny(intra_doc_link_resolution_failure)] -#![feature(associated_type_defaults)] - -pub trait TraitWithDefault { - type T = usize; - fn f() -> Self::T { - 0 - } -} - -/// Link to [UsesDefaults::T] and [UsesDefaults::f] -// @has 'intra_link_associated_defaults/struct.UsesDefaults.html' '//a[@href="../intra_link_associated_defaults/struct.UsesDefaults.html#associatedtype.T"]' 'UsesDefaults::T' -// @has 'intra_link_associated_defaults/struct.UsesDefaults.html' '//a[@href="../intra_link_associated_defaults/struct.UsesDefaults.html#method.f"]' 'UsesDefaults::f' -pub struct UsesDefaults; -impl TraitWithDefault for UsesDefaults {} - -/// Link to [OverridesDefaults::T] and [OverridesDefaults::f] -// @has 'intra_link_associated_defaults/struct.OverridesDefaults.html' '//a[@href="../intra_link_associated_defaults/struct.OverridesDefaults.html#associatedtype.T"]' 'OverridesDefaults::T' -// @has 'intra_link_associated_defaults/struct.OverridesDefaults.html' '//a[@href="../intra_link_associated_defaults/struct.OverridesDefaults.html#method.f"]' 'OverridesDefaults::f' -pub struct OverridesDefaults; -impl TraitWithDefault for OverridesDefaults { - type T = bool; - fn f() -> bool { - true - } -} diff --git a/src/test/rustdoc/intra-link-associated-items.rs b/src/test/rustdoc/intra-link-associated-items.rs deleted file mode 100644 index daf7075a91740..0000000000000 --- a/src/test/rustdoc/intra-link-associated-items.rs +++ /dev/null @@ -1,61 +0,0 @@ -// ignore-tidy-linelength -#![deny(intra_doc_link_resolution_failure)] - -/// [`std::collections::BTreeMap::into_iter`] -/// [`String::from`] is ambiguous as to which `From` impl -/// [Vec::into_iter()] uses a disambiguator -// @has 'intra_link_associated_items/fn.foo.html' '//a[@href="https://doc.rust-lang.org/nightly/alloc/collections/btree/map/struct.BTreeMap.html#method.into_iter"]' 'std::collections::BTreeMap::into_iter' -// @has 'intra_link_associated_items/fn.foo.html' '//a[@href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html#method.from"]' 'String::from' -// @has 'intra_link_associated_items/fn.foo.html' '//a[@href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html#method.into_iter"]' 'Vec::into_iter' -pub fn foo() {} - -/// Link to [MyStruct], [link from struct][MyStruct::method], [MyStruct::clone], [MyStruct::Input] -// @has 'intra_link_associated_items/struct.MyStruct.html' '//a[@href="../intra_link_associated_items/struct.MyStruct.html"]' 'MyStruct' -// @has 'intra_link_associated_items/struct.MyStruct.html' '//a[@href="../intra_link_associated_items/struct.MyStruct.html#method.method"]' 'link from struct' -// @has 'intra_link_associated_items/struct.MyStruct.html' '//a[@href="../intra_link_associated_items/struct.MyStruct.html#method.clone"]' 'MyStruct::clone' -// @has 'intra_link_associated_items/struct.MyStruct.html' '//a[@href="../intra_link_associated_items/struct.MyStruct.html#associatedtype.Input"]' 'MyStruct::Input' -pub struct MyStruct { foo: () } - -impl Clone for MyStruct { - fn clone(&self) -> Self { - MyStruct - } -} - -pub trait T { - type Input; - fn method(i: Self::Input); -} - -impl T for MyStruct { - type Input = usize; - - /// [link from method][MyStruct::method] on method - // @has 'intra_link_associated_items/struct.MyStruct.html' '//a[@href="../intra_link_associated_items/struct.MyStruct.html#method.method"]' 'link from method' - fn method(i: usize) { - } -} - -/// Ambiguity between which trait to use -pub trait T1 { - fn ambiguous_method(); -} - -pub trait T2 { - fn ambiguous_method(); -} - -/// Link to [S::ambiguous_method] -// FIXME: there is no way to disambiguate these. -// Since we have `#[deny(intra_doc_failure)]`, we still know it was one or the other. -pub struct S; - -impl T1 for S { - fn ambiguous_method() {} -} - -impl T2 for S { - fn ambiguous_method() {} -} - -fn main() {} diff --git a/src/test/rustdoc/intra-link-disambiguators-removed.rs b/src/test/rustdoc/intra-link-disambiguators-removed.rs deleted file mode 100644 index 26d05b484b919..0000000000000 --- a/src/test/rustdoc/intra-link-disambiguators-removed.rs +++ /dev/null @@ -1,51 +0,0 @@ -// ignore-tidy-linelength -#![deny(intra_doc_link_resolution_failure)] -// first try backticks -/// Trait: [`trait@Name`], fn: [`fn@Name`], [`Name`][`macro@Name`] -// @has intra_link_disambiguators_removed/struct.AtDisambiguator.html -// @has - '//a[@href="../intra_link_disambiguators_removed/trait.Name.html"][code]' "Name" -// @has - '//a[@href="../intra_link_disambiguators_removed/fn.Name.html"][code]' "Name" -// @has - '//a[@href="../intra_link_disambiguators_removed/macro.Name.html"][code]' "Name" -pub struct AtDisambiguator; - -/// fn: [`Name()`], macro: [`Name!`] -// @has intra_link_disambiguators_removed/struct.SymbolDisambiguator.html -// @has - '//a[@href="../intra_link_disambiguators_removed/fn.Name.html"][code]' "Name()" -// @has - '//a[@href="../intra_link_disambiguators_removed/macro.Name.html"][code]' "Name!" -pub struct SymbolDisambiguator; - -// Now make sure that backticks aren't added if they weren't already there -/// [fn@Name] -// @has intra_link_disambiguators_removed/trait.Name.html -// @has - '//a[@href="../intra_link_disambiguators_removed/fn.Name.html"]' "Name" -// @!has - '//a[@href="../intra_link_disambiguators_removed/fn.Name.html"][code]' "Name" - -// FIXME: this will turn !() into ! alone -/// [Name!()] -// @has - '//a[@href="../intra_link_disambiguators_removed/macro.Name.html"]' "Name!" -pub trait Name {} - -#[allow(non_snake_case)] - -// Try collapsed reference links -/// [macro@Name][] -// @has intra_link_disambiguators_removed/fn.Name.html -// @has - '//a[@href="../intra_link_disambiguators_removed/macro.Name.html"]' "Name" - -// Try links that have the same text as a generated URL -/// Weird URL aligned [../intra_link_disambiguators_removed/macro.Name.html][trait@Name] -// @has - '//a[@href="../intra_link_disambiguators_removed/trait.Name.html"]' "../intra_link_disambiguators_removed/macro.Name.html" -pub fn Name() {} - -#[macro_export] -// Rustdoc doesn't currently handle links that have weird interspersing of inline code blocks. -/// [fn@Na`m`e] -// @has intra_link_disambiguators_removed/macro.Name.html -// @has - '//a[@href="../intra_link_disambiguators_removed/fn.Name.html"]' "fn@Name" - -// It also doesn't handle any case where the code block isn't the whole link text: -/// [trait@`Name`] -// @has - '//a[@href="../intra_link_disambiguators_removed/trait.Name.html"]' "trait@Name" -macro_rules! Name { - () => () -} diff --git a/src/test/rustdoc/intra-link-extern-type.rs b/src/test/rustdoc/intra-link-extern-type.rs deleted file mode 100644 index 418e0d91ea7ef..0000000000000 --- a/src/test/rustdoc/intra-link-extern-type.rs +++ /dev/null @@ -1,18 +0,0 @@ -#![feature(extern_types)] - -extern { - pub type ExternType; -} - -impl ExternType { - pub fn f(&self) { - - } -} - -// @has 'intra_link_extern_type/foreigntype.ExternType.html' -// @has 'intra_link_extern_type/fn.links_to_extern_type.html' \ -// 'href="../intra_link_extern_type/foreigntype.ExternType.html#method.f"' -/// See also [ExternType::f] -pub fn links_to_extern_type() { -} diff --git a/src/test/rustdoc/intra-link-prim-assoc.rs b/src/test/rustdoc/intra-link-prim-assoc.rs deleted file mode 100644 index c0066885e1991..0000000000000 --- a/src/test/rustdoc/intra-link-prim-assoc.rs +++ /dev/null @@ -1,5 +0,0 @@ -// ignore-tidy-linelength -#![deny(broken_intra_doc_links)] - -//! [i32::MAX] -// @has intra_link_prim_assoc/index.html '//a[@href="https://doc.rust-lang.org/nightly/std/primitive.i32.html#associatedconstant.MAX"]' "i32::MAX" diff --git a/src/test/rustdoc/intra-link-prim-precedence.rs b/src/test/rustdoc/intra-link-prim-precedence.rs deleted file mode 100644 index 0a4e57ef643e7..0000000000000 --- a/src/test/rustdoc/intra-link-prim-precedence.rs +++ /dev/null @@ -1,17 +0,0 @@ -// ignore-tidy-linelength -#![deny(broken_intra_doc_links)] - -pub mod char { - /// [char] - // @has intra_link_prim_precedence/char/struct.Inner.html '//a/@href' 'https://doc.rust-lang.org/nightly/std/primitive.char.html' - pub struct Inner; -} - -/// See [prim@char] -// @has intra_link_prim_precedence/struct.MyString.html '//a/@href' 'https://doc.rust-lang.org/nightly/std/primitive.char.html' -pub struct MyString; - -/// See also [crate::char] and [mod@char] -// @has intra_link_prim_precedence/struct.MyString2.html '//*[@href="../intra_link_prim_precedence/char/index.html"]' 'crate::char' -// @has - '//*[@href="../intra_link_prim_precedence/char/index.html"]' 'mod@char' -pub struct MyString2; diff --git a/src/test/rustdoc/intra-link-proc-macro.rs b/src/test/rustdoc/intra-link-proc-macro.rs deleted file mode 100644 index 7a8403255edb6..0000000000000 --- a/src/test/rustdoc/intra-link-proc-macro.rs +++ /dev/null @@ -1,27 +0,0 @@ -// aux-build:intra-link-proc-macro-macro.rs -// build-aux-docs -#![deny(broken_intra_doc_links)] - -extern crate intra_link_proc_macro_macro; - - -pub use intra_link_proc_macro_macro::{DeriveA, attr_a}; -use intra_link_proc_macro_macro::{DeriveB, attr_b}; - -// @has intra_link_proc_macro/struct.Foo.html -// @has - '//a/@href' '../intra_link_proc_macro/derive.DeriveA.html' -// @has - '//a/@href' '../intra_link_proc_macro/attr.attr_a.html' -// @has - '//a/@href' '../intra_link_proc_macro/trait.DeriveTrait.html' -// @has - '//a/@href' '../intra_link_proc_macro_macro/derive.DeriveB.html' -// @has - '//a/@href' '../intra_link_proc_macro_macro/attr.attr_b.html' -/// Link to [DeriveA], [attr_a], [DeriveB], [attr_b], [DeriveTrait] -pub struct Foo; - -// @has intra_link_proc_macro/struct.Bar.html -// @has - '//a/@href' '../intra_link_proc_macro/derive.DeriveA.html' -// @has - '//a/@href' '../intra_link_proc_macro/attr.attr_a.html' -/// Link to [deriveA](derive@DeriveA) [attr](macro@attr_a) -pub struct Bar; - -// this should not cause ambiguity errors -pub trait DeriveTrait {}