Skip to content

Commit

Permalink
Add help for intra-link lint
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jun 13, 2018
1 parent 8c43c93 commit 2e343f3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/librustdoc/clean/mod.rs
Expand Up @@ -1311,10 +1311,12 @@ fn resolution_failure(
diag
} else {
cx.tcx.struct_span_lint_node(lint::builtin::INTRA_LINK_RESOLUTION_FAILURE,
NodeId::new(0),
sp,
&msg)
NodeId::new(0),
sp,
&msg)
};
diag.help("to escape `[` and `]` characters, either put them into \"`[]`\" or \
use HTML values `[` and `]`");
diag.emit();
}

Expand Down
Expand Up @@ -9,4 +9,5 @@ note: lint level defined here
|
11 | #![deny(intra_link_resolution_failure)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: to escape `[` and `]` characters, either put them into "`[]`" or use HTML values `[` and `]`

19 changes: 19 additions & 0 deletions src/test/rustdoc-ui/intra-links-warning.stderr
Expand Up @@ -5,48 +5,63 @@ warning: `[Foo::baz]` cannot be resolved, ignoring it...
| ^^^^^^^^ cannot be resolved, ignoring
|
= note: #[warn(intra_link_resolution_failure)] on by default
= help: to escape `[` and `]` characters, either put them into "`[]`" or use HTML values `[` and `]`

warning: `[Bar::foo]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:13:35
|
13 | //! Test with [Foo::baz], [Bar::foo], ...
| ^^^^^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, either put them into "`[]`" or use HTML values `[` and `]`

warning: `[Uniooon::X]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:14:13
|
14 | //! , [Uniooon::X] and [Qux::Z].
| ^^^^^^^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, either put them into "`[]`" or use HTML values `[` and `]`

warning: `[Qux::Z]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:14:30
|
14 | //! , [Uniooon::X] and [Qux::Z].
| ^^^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, either put them into "`[]`" or use HTML values `[` and `]`

warning: `[Uniooon::X]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:16:14
|
16 | //! , [Uniooon::X] and [Qux::Z].
| ^^^^^^^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, either put them into "`[]`" or use HTML values `[` and `]`

warning: `[Qux::Z]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:16:31
|
16 | //! , [Uniooon::X] and [Qux::Z].
| ^^^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, either put them into "`[]`" or use HTML values `[` and `]`

warning: `[Qux:Y]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:18:13
|
18 | /// [Qux:Y]
| ^^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, either put them into "`[]`" or use HTML values `[` and `]`

warning: `[BarA]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:24:10
|
24 | /// bar [BarA] bar
| ^^^^ cannot be resolved, ignoring
|
= help: to escape `[` and `]` characters, either put them into "`[]`" or use HTML values `[` and `]`

warning: `[BarB]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:28:1
Expand All @@ -62,6 +77,7 @@ warning: `[BarB]` cannot be resolved, ignoring it...

bar [BarB] bar
^^^^
= help: to escape `[` and `]` characters, either put them into "`[]`" or use HTML values `[` and `]`

warning: `[BarC]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:35:1
Expand All @@ -79,6 +95,7 @@ warning: `[BarC]` cannot be resolved, ignoring it...

bar [BarC] bar
^^^^
= help: to escape `[` and `]` characters, either put them into "`[]`" or use HTML values `[` and `]`

warning: `[BarD]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:48:1
Expand All @@ -90,6 +107,7 @@ warning: `[BarD]` cannot be resolved, ignoring it...

bar [BarD] bar
^^^^
= help: to escape `[` and `]` characters, either put them into "`[]`" or use HTML values `[` and `]`

warning: `[BarF]` cannot be resolved, ignoring it...
--> $DIR/intra-links-warning.rs:53:9
Expand All @@ -104,4 +122,5 @@ warning: `[BarF]` cannot be resolved, ignoring it...

bar [BarF] bar
^^^^
= help: to escape `[` and `]` characters, either put them into "`[]`" or use HTML values `[` and `]`

0 comments on commit 2e343f3

Please sign in to comment.