diff options
| author | Joshua Nelson <jyn514@gmail.com> | 2020-08-25 16:21:02 -0400 |
|---|---|---|
| committer | Joshua Nelson <jyn514@gmail.com> | 2020-08-25 16:37:22 -0400 |
| commit | 56d3f3963c174f0a5a42d0a22f150257e8f64024 (patch) | |
| tree | 40118bd39e9387ccfabdcb33bca14bf2fafa35c3 /src/test | |
| parent | 18e7a1b799517790b8702aae11fecb1743918352 (diff) | |
| download | rust-56d3f3963c174f0a5a42d0a22f150257e8f64024.tar.gz rust-56d3f3963c174f0a5a42d0a22f150257e8f64024.zip | |
Unify error reporting for intra-doc links
- Give a suggestion even if there is no span available - Give a more accurate description of the change than 'use the disambiguator' - Write much less code
Diffstat (limited to 'src/test')
5 files changed, 86 insertions, 42 deletions
diff --git a/src/test/rustdoc-ui/intra-link-prim-conflict.rs b/src/test/rustdoc-ui/intra-link-prim-conflict.rs index 34276fbcf20..548d3e2544a 100644 --- a/src/test/rustdoc-ui/intra-link-prim-conflict.rs +++ b/src/test/rustdoc-ui/intra-link-prim-conflict.rs @@ -18,13 +18,13 @@ /// [struct@char] //~^ ERROR incompatible link -//~| HELP use its disambiguator +//~| HELP prefix with the item kind //~| NOTE resolved to a module pub mod char {} pub mod inner { //! [struct@char] //~^ ERROR incompatible link - //~| HELP use its disambiguator + //~| HELP prefix with the item kind //~| NOTE resolved to a builtin type } diff --git a/src/test/rustdoc-ui/intra-link-prim-conflict.stderr b/src/test/rustdoc-ui/intra-link-prim-conflict.stderr index b28a4426666..53dccfbf1a2 100644 --- a/src/test/rustdoc-ui/intra-link-prim-conflict.stderr +++ b/src/test/rustdoc-ui/intra-link-prim-conflict.stderr @@ -9,11 +9,11 @@ note: the lint level is defined here | LL | #![deny(broken_intra_doc_links)] | ^^^^^^^^^^^^^^^^^^^^^^ -help: to link to the module, prefix with the item type +help: to link to the module, prefix with the item kind | -LL | /// [module@char] - | ^^^^^^^^^^^ -help: to link to the builtin type, prefix with the item type +LL | /// [mod@char] + | ^^^^^^^^ +help: to link to the builtin type, prefix with the item kind | LL | /// [prim@char] | ^^^^^^^^^ @@ -24,11 +24,11 @@ error: `char` is both a module and a builtin type LL | /// [type@char] | ^^^^^^^^^ ambiguous link | -help: to link to the module, prefix with the item type +help: to link to the module, prefix with the item kind | -LL | /// [module@char] - | ^^^^^^^^^^^ -help: to link to the builtin type, prefix with the item type +LL | /// [mod@char] + | ^^^^^^^^ +help: to link to the builtin type, prefix with the item kind | LL | /// [prim@char] | ^^^^^^^^^ @@ -37,17 +37,25 @@ error: incompatible link kind for `char` --> $DIR/intra-link-prim-conflict.rs:19:6 | LL | /// [struct@char] - | ^^^^^^^^^^^ help: to link to the module, use its disambiguator: `mod@char` + | ^^^^^^^^^^^ | = note: this link resolved to a module, which is not a struct +help: to link to the module, prefix with the item kind + | +LL | /// [mod@char] + | ^^^^^^^^ error: incompatible link kind for `char` --> $DIR/intra-link-prim-conflict.rs:26:10 | LL | //! [struct@char] - | ^^^^^^^^^^^ help: to link to the builtin type, use its disambiguator: `prim@char` + | ^^^^^^^^^^^ | = note: this link resolved to a builtin type, which is not a struct +help: to link to the builtin type, prefix with the item kind + | +LL | //! [prim@char] + | ^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/rustdoc-ui/intra-links-ambiguity.stderr b/src/test/rustdoc-ui/intra-links-ambiguity.stderr index 35262c1b612..7912c046f1c 100644 --- a/src/test/rustdoc-ui/intra-links-ambiguity.stderr +++ b/src/test/rustdoc-ui/intra-links-ambiguity.stderr @@ -9,7 +9,7 @@ note: the lint level is defined here | LL | #![deny(broken_intra_doc_links)] | ^^^^^^^^^^^^^^^^^^^^^^ -help: to link to the struct, prefix with the item type +help: to link to the struct, prefix with the item kind | LL | /// [`struct@ambiguous`] is ambiguous. | ^^^^^^^^^^^^^^^^^^ @@ -24,7 +24,7 @@ error: `ambiguous` is both a struct and a function LL | /// [ambiguous] is ambiguous. | ^^^^^^^^^ ambiguous link | -help: to link to the struct, prefix with the item type +help: to link to the struct, prefix with the item kind | LL | /// [struct@ambiguous] is ambiguous. | ^^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ error: `multi_conflict` is a struct, a function, and a macro LL | /// [`multi_conflict`] is a three-way conflict. | ^^^^^^^^^^^^^^^^ ambiguous link | -help: to link to the struct, prefix with the item type +help: to link to the struct, prefix with the item kind | LL | /// [`struct@multi_conflict`] is a three-way conflict. | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -58,11 +58,11 @@ error: `type_and_value` is both a module and a constant LL | /// Ambiguous [type_and_value]. | ^^^^^^^^^^^^^^ ambiguous link | -help: to link to the module, prefix with the item type +help: to link to the module, prefix with the item kind | -LL | /// Ambiguous [module@type_and_value]. - | ^^^^^^^^^^^^^^^^^^^^^ -help: to link to the constant, prefix with the item type +LL | /// Ambiguous [mod@type_and_value]. + | ^^^^^^^^^^^^^^^^^^ +help: to link to the constant, prefix with the item kind | LL | /// Ambiguous [const@type_and_value]. | ^^^^^^^^^^^^^^^^^^^^ @@ -73,7 +73,7 @@ error: `foo::bar` is both an enum and a function LL | /// Ambiguous non-implied shortcut link [`foo::bar`]. | ^^^^^^^^^^ ambiguous link | -help: to link to the enum, prefix with the item type +help: to link to the enum, prefix with the item kind | LL | /// Ambiguous non-implied shortcut link [`enum@foo::bar`]. | ^^^^^^^^^^^^^^^ diff --git a/src/test/rustdoc-ui/intra-links-disambiguator-mismatch.rs b/src/test/rustdoc-ui/intra-links-disambiguator-mismatch.rs index 1a7a2fce7a3..54e507adfe5 100644 --- a/src/test/rustdoc-ui/intra-links-disambiguator-mismatch.rs +++ b/src/test/rustdoc-ui/intra-links-disambiguator-mismatch.rs @@ -14,55 +14,55 @@ trait T {} /// Link to [struct@S] //~^ ERROR incompatible link kind for `S` //~| NOTE this link resolved -//~| HELP use its disambiguator +//~| HELP prefix with the item kind /// Link to [mod@S] //~^ ERROR incompatible link kind for `S` //~| NOTE this link resolved -//~| HELP use its disambiguator +//~| HELP prefix with the item kind /// Link to [union@S] //~^ ERROR incompatible link kind for `S` //~| NOTE this link resolved -//~| HELP use its disambiguator +//~| HELP prefix with the item kind /// Link to [trait@S] //~^ ERROR incompatible link kind for `S` //~| NOTE this link resolved -//~| HELP use its disambiguator +//~| HELP prefix with the item kind /// Link to [struct@T] //~^ ERROR incompatible link kind for `T` //~| NOTE this link resolved -//~| HELP use its disambiguator +//~| HELP prefix with the item kind /// Link to [derive@m] //~^ ERROR incompatible link kind for `m` //~| NOTE this link resolved -//~| HELP use its disambiguator +//~| HELP add an exclamation mark /// Link to [const@s] //~^ ERROR incompatible link kind for `s` //~| NOTE this link resolved -//~| HELP use its disambiguator +//~| HELP prefix with the item kind /// Link to [static@c] //~^ ERROR incompatible link kind for `c` //~| NOTE this link resolved -//~| HELP use its disambiguator +//~| HELP prefix with the item kind /// Link to [fn@c] //~^ ERROR incompatible link kind for `c` //~| NOTE this link resolved -//~| HELP use its disambiguator +//~| HELP prefix with the item kind /// Link to [c()] //~^ ERROR incompatible link kind for `c` //~| NOTE this link resolved -//~| HELP use its disambiguator +//~| HELP prefix with the item kind /// Link to [const@f] //~^ ERROR incompatible link kind for `f` //~| NOTE this link resolved -//~| HELP use its disambiguator +//~| HELP add parentheses pub fn f() {} diff --git a/src/test/rustdoc-ui/intra-links-disambiguator-mismatch.stderr b/src/test/rustdoc-ui/intra-links-disambiguator-mismatch.stderr index 9edf838f9d8..27b94af0378 100644 --- a/src/test/rustdoc-ui/intra-links-disambiguator-mismatch.stderr +++ b/src/test/rustdoc-ui/intra-links-disambiguator-mismatch.stderr @@ -2,7 +2,7 @@ error: incompatible link kind for `S` --> $DIR/intra-links-disambiguator-mismatch.rs:14:14 | LL | /// Link to [struct@S] - | ^^^^^^^^ help: to link to the enum, use its disambiguator: `enum@S` + | ^^^^^^^^ | note: the lint level is defined here --> $DIR/intra-links-disambiguator-mismatch.rs:1:9 @@ -10,44 +10,64 @@ note: the lint level is defined here LL | #![deny(broken_intra_doc_links)] | ^^^^^^^^^^^^^^^^^^^^^^ = note: this link resolved to an enum, which is not a struct +help: to link to the enum, prefix with the item kind + | +LL | /// Link to [enum@S] + | ^^^^^^ error: incompatible link kind for `S` --> $DIR/intra-links-disambiguator-mismatch.rs:19:14 | LL | /// Link to [mod@S] - | ^^^^^ help: to link to the enum, use its disambiguator: `enum@S` + | ^^^^^ | = note: this link resolved to an enum, which is not a module +help: to link to the enum, prefix with the item kind + | +LL | /// Link to [enum@S] + | ^^^^^^ error: incompatible link kind for `S` --> $DIR/intra-links-disambiguator-mismatch.rs:24:14 | LL | /// Link to [union@S] - | ^^^^^^^ help: to link to the enum, use its disambiguator: `enum@S` + | ^^^^^^^ | = note: this link resolved to an enum, which is not a union +help: to link to the enum, prefix with the item kind + | +LL | /// Link to [enum@S] + | ^^^^^^ error: incompatible link kind for `S` --> $DIR/intra-links-disambiguator-mismatch.rs:29:14 | LL | /// Link to [trait@S] - | ^^^^^^^ help: to link to the enum, use its disambiguator: `enum@S` + | ^^^^^^^ | = note: this link resolved to an enum, which is not a trait +help: to link to the enum, prefix with the item kind + | +LL | /// Link to [enum@S] + | ^^^^^^ error: incompatible link kind for `T` --> $DIR/intra-links-disambiguator-mismatch.rs:34:14 | LL | /// Link to [struct@T] - | ^^^^^^^^ help: to link to the trait, use its disambiguator: `trait@T` + | ^^^^^^^^ | = note: this link resolved to a trait, which is not a struct +help: to link to the trait, prefix with the item kind + | +LL | /// Link to [trait@T] + | ^^^^^^^ error: incompatible link kind for `m` --> $DIR/intra-links-disambiguator-mismatch.rs:39:14 | LL | /// Link to [derive@m] - | ^^^^^^^^ help: to link to the macro, use its disambiguator: `m!` + | ^^^^^^^^ help: to link to the macro, add an exclamation mark: `m!` | = note: this link resolved to a macro, which is not a derive macro @@ -55,39 +75,55 @@ error: incompatible link kind for `s` --> $DIR/intra-links-disambiguator-mismatch.rs:44:14 | LL | /// Link to [const@s] - | ^^^^^^^ help: to link to the static, use its disambiguator: `static@s` + | ^^^^^^^ | = note: this link resolved to a static, which is not a constant +help: to link to the static, prefix with the item kind + | +LL | /// Link to [static@s] + | ^^^^^^^^ error: incompatible link kind for `c` --> $DIR/intra-links-disambiguator-mismatch.rs:49:14 | LL | /// Link to [static@c] - | ^^^^^^^^ help: to link to the constant, use its disambiguator: `const@c` + | ^^^^^^^^ | = note: this link resolved to a constant, which is not a static +help: to link to the constant, prefix with the item kind + | +LL | /// Link to [const@c] + | ^^^^^^^ error: incompatible link kind for `c` --> $DIR/intra-links-disambiguator-mismatch.rs:54:14 | LL | /// Link to [fn@c] - | ^^^^ help: to link to the constant, use its disambiguator: `const@c` + | ^^^^ | = note: this link resolved to a constant, which is not a function +help: to link to the constant, prefix with the item kind + | +LL | /// Link to [const@c] + | ^^^^^^^ error: incompatible link kind for `c` --> $DIR/intra-links-disambiguator-mismatch.rs:59:14 | LL | /// Link to [c()] - | ^^^ help: to link to the constant, use its disambiguator: `const@c` + | ^^^ | = note: this link resolved to a constant, which is not a function +help: to link to the constant, prefix with the item kind + | +LL | /// Link to [const@c] + | ^^^^^^^ error: incompatible link kind for `f` --> $DIR/intra-links-disambiguator-mismatch.rs:64:14 | LL | /// Link to [const@f] - | ^^^^^^^ help: to link to the function, use its disambiguator: `f()` + | ^^^^^^^ help: to link to the function, add parentheses: `f()` | = note: this link resolved to a function, which is not a constant |
