Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disallow linking to items with a mismatched disambiguator
- Loading branch information
Showing
3 changed files
with
223 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#![deny(broken_intra_doc_links)] | ||
//~^ NOTE lint level is defined | ||
pub enum S {} | ||
|
||
macro_rules! m { | ||
() => {}; | ||
} | ||
|
||
static s: usize = 0; | ||
const c: usize = 0; | ||
|
||
trait T {} | ||
|
||
/// Link to [struct@S] | ||
//~^ ERROR unresolved link to `S` | ||
//~| NOTE did not match | ||
|
||
/// Link to [mod@S] | ||
//~^ ERROR unresolved link to `S` | ||
//~| NOTE did not match | ||
|
||
/// Link to [union@S] | ||
//~^ ERROR unresolved link to `S` | ||
//~| NOTE did not match | ||
|
||
/// Link to [trait@S] | ||
//~^ ERROR unresolved link to `S` | ||
//~| NOTE did not match | ||
|
||
/// Link to [struct@T] | ||
//~^ ERROR unresolved link to `T` | ||
//~| NOTE did not match | ||
|
||
/// Link to [derive@m] | ||
//~^ ERROR unresolved link to `m` | ||
//~| NOTE did not match | ||
|
||
/// Link to [const@s] | ||
//~^ ERROR unresolved link to `s` | ||
//~| NOTE did not match | ||
|
||
/// Link to [static@c] | ||
//~^ ERROR unresolved link to `c` | ||
//~| NOTE did not match | ||
|
||
/// Link to [fn@c] | ||
//~^ ERROR unresolved link to `c` | ||
//~| NOTE did not match | ||
|
||
/// Link to [c()] | ||
//~^ ERROR unresolved link to `c` | ||
//~| NOTE did not match | ||
pub fn f() {} |
127 changes: 127 additions & 0 deletions
127
src/test/rustdoc-ui/intra-links-disambiguator-mismatch.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
error: unresolved link to `S` | ||
--> $DIR/intra-links-disambiguator-mismatch.rs:16:14 | ||
| | ||
LL | /// Link to [struct@S] | ||
| ^^^^^^^^ | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/intra-links-disambiguator-mismatch.rs:1:9 | ||
| | ||
LL | #![deny(broken_intra_doc_links)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
note: this item resolved to an enum, which did not match the disambiguator 'struct' | ||
--> $DIR/intra-links-disambiguator-mismatch.rs:16:14 | ||
| | ||
LL | /// Link to [struct@S] | ||
| ^^^^^^^^ | ||
|
||
error: unresolved link to `S` | ||
--> $DIR/intra-links-disambiguator-mismatch.rs:20:14 | ||
| | ||
LL | /// Link to [mod@S] | ||
| ^^^^^ | ||
| | ||
note: this item resolved to an enum, which did not match the disambiguator 'mod' | ||
--> $DIR/intra-links-disambiguator-mismatch.rs:20:14 | ||
| | ||
LL | /// Link to [mod@S] | ||
| ^^^^^ | ||
|
||
error: unresolved link to `S` | ||
--> $DIR/intra-links-disambiguator-mismatch.rs:24:14 | ||
| | ||
LL | /// Link to [union@S] | ||
| ^^^^^^^ | ||
| | ||
note: this item resolved to an enum, which did not match the disambiguator 'union' | ||
--> $DIR/intra-links-disambiguator-mismatch.rs:24:14 | ||
| | ||
LL | /// Link to [union@S] | ||
| ^^^^^^^ | ||
|
||
error: unresolved link to `S` | ||
--> $DIR/intra-links-disambiguator-mismatch.rs:28:14 | ||
| | ||
LL | /// Link to [trait@S] | ||
| ^^^^^^^ | ||
| | ||
note: this item resolved to an enum, which did not match the disambiguator 'trait' | ||
--> $DIR/intra-links-disambiguator-mismatch.rs:28:14 | ||
| | ||
LL | /// Link to [trait@S] | ||
| ^^^^^^^ | ||
|
||
error: unresolved link to `T` | ||
--> $DIR/intra-links-disambiguator-mismatch.rs:32:14 | ||
| | ||
LL | /// Link to [struct@T] | ||
| ^^^^^^^^ | ||
| | ||
note: this item resolved to a trait, which did not match the disambiguator 'struct' | ||
--> $DIR/intra-links-disambiguator-mismatch.rs:32:14 | ||
| | ||
LL | /// Link to [struct@T] | ||
| ^^^^^^^^ | ||
|
||
error: unresolved link to `m` | ||
--> $DIR/intra-links-disambiguator-mismatch.rs:36:14 | ||
| | ||
LL | /// Link to [derive@m] | ||
| ^^^^^^^^ | ||
| | ||
note: this item resolved to a macro, which did not match the disambiguator 'derive' | ||
--> $DIR/intra-links-disambiguator-mismatch.rs:36:14 | ||
| | ||
LL | /// Link to [derive@m] | ||
| ^^^^^^^^ | ||
|
||
error: unresolved link to `s` | ||
--> $DIR/intra-links-disambiguator-mismatch.rs:40:14 | ||
| | ||
LL | /// Link to [const@s] | ||
| ^^^^^^^ | ||
| | ||
note: this item resolved to a static, which did not match the disambiguator 'const' | ||
--> $DIR/intra-links-disambiguator-mismatch.rs:40:14 | ||
| | ||
LL | /// Link to [const@s] | ||
| ^^^^^^^ | ||
|
||
error: unresolved link to `c` | ||
--> $DIR/intra-links-disambiguator-mismatch.rs:44:14 | ||
| | ||
LL | /// Link to [static@c] | ||
| ^^^^^^^^ | ||
| | ||
note: this item resolved to a constant, which did not match the disambiguator 'static' | ||
--> $DIR/intra-links-disambiguator-mismatch.rs:44:14 | ||
| | ||
LL | /// Link to [static@c] | ||
| ^^^^^^^^ | ||
|
||
error: unresolved link to `c` | ||
--> $DIR/intra-links-disambiguator-mismatch.rs:48:14 | ||
| | ||
LL | /// Link to [fn@c] | ||
| ^^^^ | ||
| | ||
note: this item resolved to a constant, which did not match the disambiguator 'fn' | ||
--> $DIR/intra-links-disambiguator-mismatch.rs:48:14 | ||
| | ||
LL | /// Link to [fn@c] | ||
| ^^^^ | ||
|
||
error: unresolved link to `c` | ||
--> $DIR/intra-links-disambiguator-mismatch.rs:52:14 | ||
| | ||
LL | /// Link to [c()] | ||
| ^^^ | ||
| | ||
note: this item resolved to a constant, which did not match the disambiguator 'fn' | ||
--> $DIR/intra-links-disambiguator-mismatch.rs:52:14 | ||
| | ||
LL | /// Link to [c()] | ||
| ^^^ | ||
|
||
error: aborting due to 10 previous errors | ||
|