Rollup merge of #79527 - jyn514:intra-doc-tests, r=Manishearth

Move intra-doc link tests into a subdirectory

They were starting to get unwieldy.

r? ``@Manishearth``
This commit is contained in:
Mara Bos 2020-12-01 10:50:19 +00:00 committed by GitHub
commit f45e6953d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
94 changed files with 352 additions and 387 deletions

View File

@ -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" });

View File

@ -1 +0,0 @@
intra-links-warning-crlf.rs eol=crlf

View File

@ -0,0 +1 @@
warning-crlf.rs eol=crlf

View File

@ -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)]
| ^^^^^^^^^^^^^^^^^^^^^^

View File

@ -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

View File

@ -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

View File

@ -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()`

View File

@ -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

View File

@ -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()]
| ^^^

View File

@ -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<Box<T`
--> $DIR/intra-link-malformed-generics.rs:4:6
--> $DIR/malformed-generics.rs:4:6
|
LL | //! [Vec<Box<T]
| ^^^^^^^^^ unbalanced angle brackets
error: unresolved link to `Vec<Box<T>`
--> $DIR/intra-link-malformed-generics.rs:5:6
--> $DIR/malformed-generics.rs:5:6
|
LL | //! [Vec<Box<T>]
| ^^^^^^^^^^ unbalanced angle brackets
error: unresolved link to `Vec<Box<T>>>`
--> $DIR/intra-link-malformed-generics.rs:6:6
--> $DIR/malformed-generics.rs:6:6
|
LL | //! [Vec<Box<T>>>]
| ^^^^^^^^^^^^ unbalanced angle brackets
error: unresolved link to `Vec<T>>>`
--> $DIR/intra-link-malformed-generics.rs:7:6
--> $DIR/malformed-generics.rs:7:6
|
LL | //! [Vec<T>>>]
| ^^^^^^^^ unbalanced angle brackets
error: unresolved link to `<Vec`
--> $DIR/intra-link-malformed-generics.rs:8:6
--> $DIR/malformed-generics.rs:8:6
|
LL | //! [<Vec]
| ^^^^ unbalanced angle brackets
error: unresolved link to `Vec::<`
--> $DIR/intra-link-malformed-generics.rs:9:6
--> $DIR/malformed-generics.rs:9:6
|
LL | //! [Vec::<]
| ^^^^^^ unbalanced angle brackets
error: unresolved link to `<T>`
--> $DIR/intra-link-malformed-generics.rs:10:6
--> $DIR/malformed-generics.rs:10:6
|
LL | //! [<T>]
| ^^^ missing type for generic parameters
error: unresolved link to `<invalid syntax>`
--> $DIR/intra-link-malformed-generics.rs:11:6
--> $DIR/malformed-generics.rs:11:6
|
LL | //! [<invalid syntax>]
| ^^^^^^^^^^^^^^^^ missing type for generic parameters
error: unresolved link to `Vec:<T>:new`
--> $DIR/intra-link-malformed-generics.rs:12:6
--> $DIR/malformed-generics.rs:12:6
|
LL | //! [Vec:<T>:new()]
| ^^^^^^^^^^^^^ has invalid path separator
error: unresolved link to `Vec<<T>>`
--> $DIR/intra-link-malformed-generics.rs:13:6
--> $DIR/malformed-generics.rs:13:6
|
LL | //! [Vec<<T>>]
| ^^^^^^^^ 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 `<Vec as IntoIterator>::into_iter`
--> $DIR/intra-link-malformed-generics.rs:18:6
--> $DIR/malformed-generics.rs:18:6
|
LL | //! [<Vec as IntoIterator>::into_iter]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ fully-qualified syntax is unsupported
@ -91,7 +91,7 @@ LL | //! [<Vec as IntoIterator>::into_iter]
= note: see https://github.com/rust-lang/rust/issues/74563 for more information
error: unresolved link to `<Vec<T> as IntoIterator>::iter`
--> $DIR/intra-link-malformed-generics.rs:19:6
--> $DIR/malformed-generics.rs:19:6
|
LL | //! [<Vec<T> as IntoIterator>::iter]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ fully-qualified syntax is unsupported

View File

@ -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`

View File

@ -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

View File

@ -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

View File

@ -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)]
| ^^^^^^^^^^^^^^^^^^^^^^

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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...
///

View File

@ -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
}
}

View File

@ -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() {}

View File

@ -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;

View File

@ -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`]

View File

@ -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]

View File

@ -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 {
() => ()
}

View File

@ -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() {}

View File

@ -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;

View File

@ -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"

View File

@ -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'

View File

@ -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'

View File

@ -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'

View File

@ -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;

View File

@ -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`]

View File

@ -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 {}

View File

@ -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;

View File

@ -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
}
}

View File

@ -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() {}

View File

@ -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 {
() => ()
}

View File

@ -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() {
}

View File

@ -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"

View File

@ -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;

View File

@ -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 {}