Skip to content

Commit 2e343f3

Browse files
Add help for intra-link lint
1 parent 8c43c93 commit 2e343f3

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

src/librustdoc/clean/mod.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,10 +1311,12 @@ fn resolution_failure(
13111311
diag
13121312
} else {
13131313
cx.tcx.struct_span_lint_node(lint::builtin::INTRA_LINK_RESOLUTION_FAILURE,
1314-
NodeId::new(0),
1315-
sp,
1316-
&msg)
1314+
NodeId::new(0),
1315+
sp,
1316+
&msg)
13171317
};
1318+
diag.help("to escape `[` and `]` characters, either put them into \"`[]`\" or \
1319+
use HTML values `[` and `]`");
13181320
diag.emit();
13191321
}
13201322

src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ note: lint level defined here
99
|
1010
11 | #![deny(intra_link_resolution_failure)]
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
= help: to escape `[` and `]` characters, either put them into "`[]`" or use HTML values `[` and `]`
1213

src/test/rustdoc-ui/intra-links-warning.stderr

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,48 +5,63 @@ warning: `[Foo::baz]` cannot be resolved, ignoring it...
55
| ^^^^^^^^ cannot be resolved, ignoring
66
|
77
= note: #[warn(intra_link_resolution_failure)] on by default
8+
= help: to escape `[` and `]` characters, either put them into "`[]`" or use HTML values `[` and `]`
89

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

0 commit comments

Comments
 (0)