Skip to content

Commit 0193a88

Browse files
committed
Remove unhelpful help message
1 parent 87f3f81 commit 0193a88

8 files changed

+21
-64
lines changed

src/librustdoc/passes/collect_intra_doc_links.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1585,13 +1585,14 @@ fn resolution_failure(
15851585
} else {
15861586
diag.note(&note);
15871587
}
1588-
diag.help(&format!("did you mean to import `{}`?", unresolved));
1588+
15891589
// If the link has `::` in it, assume it was meant to be an intra-doc link.
15901590
// Otherwise, the `[]` might be unrelated.
15911591
// FIXME: don't show this for autolinks (`<>`), `()` style links, or reference links
15921592
if !path_str.contains("::") {
15931593
diag.help(r#"to escape `[` and `]` characters, add '\' before them like `\[` or `\]`"#);
15941594
}
1595+
15951596
continue;
15961597
}
15971598

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

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ note: the lint level is defined here
99
|
1010
LL | #![deny(broken_intra_doc_links)]
1111
| ^^^^^^^^^^^^^^^^^^^^^^
12-
= help: did you mean to import `v2`?
1312
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
1413

1514
error: aborting due to previous error

src/test/rustdoc-ui/intra-link-errors.rs

-5
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,22 @@
77
/// [path::to::nonexistent::module]
88
//~^ ERROR unresolved link
99
//~| NOTE there is no item named `path` in scope
10-
//~| HELP did you mean to import `path`?
1110

1211
/// [path::to::nonexistent::macro!]
1312
//~^ ERROR unresolved link
1413
//~| NOTE there is no item named `path` in scope
15-
//~| HELP did you mean to import `path`?
1614

1715
/// [type@path::to::nonexistent::type]
1816
//~^ ERROR unresolved link
1917
//~| NOTE there is no item named `path` in scope
20-
//~| HELP did you mean to import `path`?
2118

2219
/// [std::io::not::here]
2320
//~^ ERROR unresolved link
2421
//~| NOTE there is no item named `not` in scope
25-
//~| HELP did you mean to import `not`?
2622

2723
/// [type@std::io::not::here]
2824
//~^ ERROR unresolved link
2925
//~| NOTE there is no item named `not` in scope
30-
//~| HELP did you mean to import `not`?
3126

3227
/// [std::io::Error::x]
3328
//~^ ERROR unresolved link

src/test/rustdoc-ui/intra-link-errors.stderr

+19-28
Original file line numberDiff line numberDiff line change
@@ -9,96 +9,87 @@ note: the lint level is defined here
99
|
1010
LL | #![deny(broken_intra_doc_links)]
1111
| ^^^^^^^^^^^^^^^^^^^^^^
12-
= help: did you mean to import `path`?
1312

1413
error: unresolved link to `path::to::nonexistent::macro`
15-
--> $DIR/intra-link-errors.rs:12:6
14+
--> $DIR/intra-link-errors.rs:11:6
1615
|
1716
LL | /// [path::to::nonexistent::macro!]
1817
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ there is no item named `path` in scope
19-
|
20-
= help: did you mean to import `path`?
2118

2219
error: unresolved link to `path::to::nonexistent::type`
23-
--> $DIR/intra-link-errors.rs:17:6
20+
--> $DIR/intra-link-errors.rs:15:6
2421
|
2522
LL | /// [type@path::to::nonexistent::type]
2623
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ there is no item named `path` in scope
27-
|
28-
= help: did you mean to import `path`?
2924

3025
error: unresolved link to `std::io::not::here`
31-
--> $DIR/intra-link-errors.rs:22:6
26+
--> $DIR/intra-link-errors.rs:19:6
3227
|
3328
LL | /// [std::io::not::here]
3429
| ^^^^^^^^^^^^^^^^^^ there is no item named `not` in scope
35-
|
36-
= help: did you mean to import `not`?
3730

3831
error: unresolved link to `std::io::not::here`
39-
--> $DIR/intra-link-errors.rs:27:6
32+
--> $DIR/intra-link-errors.rs:23:6
4033
|
4134
LL | /// [type@std::io::not::here]
4235
| ^^^^^^^^^^^^^^^^^^^^^^^ there is no item named `not` in scope
43-
|
44-
= help: did you mean to import `not`?
4536

4637
error: unresolved link to `std::io::Error::x`
47-
--> $DIR/intra-link-errors.rs:32:6
38+
--> $DIR/intra-link-errors.rs:27:6
4839
|
4940
LL | /// [std::io::Error::x]
5041
| ^^^^^^^^^^^^^^^^^ the struct `Error` has no field or associated item named `x`
5142

5243
error: unresolved link to `std::io::ErrorKind::x`
53-
--> $DIR/intra-link-errors.rs:36:6
44+
--> $DIR/intra-link-errors.rs:31:6
5445
|
5546
LL | /// [std::io::ErrorKind::x]
5647
| ^^^^^^^^^^^^^^^^^^^^^ the enum `ErrorKind` has no variant or associated item named `x`
5748

5849
error: unresolved link to `f::A`
59-
--> $DIR/intra-link-errors.rs:40:6
50+
--> $DIR/intra-link-errors.rs:35:6
6051
|
6152
LL | /// [f::A]
6253
| ^^^^ `f` is a function, not a module or type, and cannot have associated items
6354

6455
error: unresolved link to `f::A`
65-
--> $DIR/intra-link-errors.rs:44:6
56+
--> $DIR/intra-link-errors.rs:39:6
6657
|
6758
LL | /// [f::A!]
6859
| ^^^^^ `f` is a function, not a module or type, and cannot have associated items
6960

7061
error: unresolved link to `S::A`
71-
--> $DIR/intra-link-errors.rs:48:6
62+
--> $DIR/intra-link-errors.rs:43:6
7263
|
7364
LL | /// [S::A]
7465
| ^^^^ the struct `S` has no field or associated item named `A`
7566

7667
error: unresolved link to `S::fmt`
77-
--> $DIR/intra-link-errors.rs:52:6
68+
--> $DIR/intra-link-errors.rs:47:6
7869
|
7970
LL | /// [S::fmt]
8071
| ^^^^^^ the struct `S` has no field or associated item named `fmt`
8172

8273
error: unresolved link to `E::D`
83-
--> $DIR/intra-link-errors.rs:56:6
74+
--> $DIR/intra-link-errors.rs:51:6
8475
|
8576
LL | /// [E::D]
8677
| ^^^^ the enum `E` has no variant or associated item named `D`
8778

8879
error: unresolved link to `u8::not_found`
89-
--> $DIR/intra-link-errors.rs:60:6
80+
--> $DIR/intra-link-errors.rs:55:6
9081
|
9182
LL | /// [u8::not_found]
9283
| ^^^^^^^^^^^^^ the builtin type `u8` has no associated item named `not_found`
9384

9485
error: unresolved link to `std::primitive::u8::not_found`
95-
--> $DIR/intra-link-errors.rs:64:6
86+
--> $DIR/intra-link-errors.rs:59:6
9687
|
9788
LL | /// [std::primitive::u8::not_found]
9889
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the builtin type `u8` has no associated item named `not_found`
9990

10091
error: unresolved link to `Vec::into_iter`
101-
--> $DIR/intra-link-errors.rs:68:6
92+
--> $DIR/intra-link-errors.rs:63:6
10293
|
10394
LL | /// [type@Vec::into_iter]
10495
| ^^^^^^^^^^^^^^^^^^^
@@ -107,7 +98,7 @@ LL | /// [type@Vec::into_iter]
10798
| help: to link to the associated function, add parentheses: `Vec::into_iter()`
10899

109100
error: unresolved link to `S`
110-
--> $DIR/intra-link-errors.rs:73:6
101+
--> $DIR/intra-link-errors.rs:68:6
111102
|
112103
LL | /// [S!]
113104
| ^^
@@ -116,7 +107,7 @@ LL | /// [S!]
116107
| help: to link to the struct, prefix with `struct@`: `struct@S`
117108

118109
error: unresolved link to `T::g`
119-
--> $DIR/intra-link-errors.rs:91:6
110+
--> $DIR/intra-link-errors.rs:86:6
120111
|
121112
LL | /// [type@T::g]
122113
| ^^^^^^^^^
@@ -125,13 +116,13 @@ LL | /// [type@T::g]
125116
| help: to link to the associated function, add parentheses: `T::g()`
126117

127118
error: unresolved link to `T::h`
128-
--> $DIR/intra-link-errors.rs:96:6
119+
--> $DIR/intra-link-errors.rs:91:6
129120
|
130121
LL | /// [T::h!]
131122
| ^^^^^ the trait `T` has no macro named `h`
132123

133124
error: unresolved link to `S::h`
134-
--> $DIR/intra-link-errors.rs:83:6
125+
--> $DIR/intra-link-errors.rs:78:6
135126
|
136127
LL | /// [type@S::h]
137128
| ^^^^^^^^^
@@ -140,7 +131,7 @@ LL | /// [type@S::h]
140131
| help: to link to the associated function, add parentheses: `S::h()`
141132

142133
error: unresolved link to `m`
143-
--> $DIR/intra-link-errors.rs:103:6
134+
--> $DIR/intra-link-errors.rs:98:6
144135
|
145136
LL | /// [m()]
146137
| ^^^

src/test/rustdoc-ui/intra-link-span-ice-55723.stderr

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ note: the lint level is defined here
99
|
1010
LL | #![deny(broken_intra_doc_links)]
1111
| ^^^^^^^^^^^^^^^^^^^^^^
12-
= help: did you mean to import `i`?
1312
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
1413

1514
error: aborting due to previous error

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

-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ LL | /// [error]
55
| ^^^^^ there is no item named `error` in scope
66
|
77
= note: `#[warn(broken_intra_doc_links)]` on by default
8-
= help: did you mean to import `error`?
98
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
109

1110
warning: unresolved link to `error1`
@@ -14,7 +13,6 @@ warning: unresolved link to `error1`
1413
LL | /// docs [error1]
1514
| ^^^^^^ there is no item named `error1` in scope
1615
|
17-
= help: did you mean to import `error1`?
1816
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
1917

2018
warning: unresolved link to `error2`
@@ -23,7 +21,6 @@ warning: unresolved link to `error2`
2321
LL | /// docs [error2]
2422
| ^^^^^^ there is no item named `error2` in scope
2523
|
26-
= help: did you mean to import `error2`?
2724
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
2825

2926
warning: unresolved link to `error`
@@ -32,7 +29,6 @@ warning: unresolved link to `error`
3229
LL | * It also has an [error].
3330
| ^^^^^ there is no item named `error` in scope
3431
|
35-
= help: did you mean to import `error`?
3632
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
3733

3834
warning: 4 warnings emitted

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

-23
Original file line numberDiff line numberDiff line change
@@ -11,48 +11,37 @@ warning: unresolved link to `Bar::foo`
1111
|
1212
LL | //! Test with [Foo::baz], [Bar::foo], ...
1313
| ^^^^^^^^ there is no item named `Bar` in scope
14-
|
15-
= help: did you mean to import `Bar`?
1614

1715
warning: unresolved link to `Uniooon::X`
1816
--> $DIR/intra-links-warning.rs:6:13
1917
|
2018
LL | //! , [Uniooon::X] and [Qux::Z].
2119
| ^^^^^^^^^^ there is no item named `Uniooon` in scope
22-
|
23-
= help: did you mean to import `Uniooon`?
2420

2521
warning: unresolved link to `Qux::Z`
2622
--> $DIR/intra-links-warning.rs:6:30
2723
|
2824
LL | //! , [Uniooon::X] and [Qux::Z].
2925
| ^^^^^^ there is no item named `Qux` in scope
30-
|
31-
= help: did you mean to import `Qux`?
3226

3327
warning: unresolved link to `Uniooon::X`
3428
--> $DIR/intra-links-warning.rs:10:14
3529
|
3630
LL | //! , [Uniooon::X] and [Qux::Z].
3731
| ^^^^^^^^^^ there is no item named `Uniooon` in scope
38-
|
39-
= help: did you mean to import `Uniooon`?
4032

4133
warning: unresolved link to `Qux::Z`
4234
--> $DIR/intra-links-warning.rs:10:31
4335
|
4436
LL | //! , [Uniooon::X] and [Qux::Z].
4537
| ^^^^^^ there is no item named `Qux` in scope
46-
|
47-
= help: did you mean to import `Qux`?
4838

4939
warning: unresolved link to `Qux:Y`
5040
--> $DIR/intra-links-warning.rs:14:13
5141
|
5242
LL | /// [Qux:Y]
5343
| ^^^^^ there is no item named `Qux:Y` in scope
5444
|
55-
= help: did you mean to import `Qux:Y`?
5645
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
5746

5847
warning: unresolved link to `error`
@@ -61,7 +50,6 @@ warning: unresolved link to `error`
6150
LL | * time to introduce a link [error]*/
6251
| ^^^^^ there is no item named `error` in scope
6352
|
64-
= help: did you mean to import `error`?
6553
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
6654

6755
warning: unresolved link to `error`
@@ -70,7 +58,6 @@ warning: unresolved link to `error`
7058
LL | * time to introduce a link [error]
7159
| ^^^^^ there is no item named `error` in scope
7260
|
73-
= help: did you mean to import `error`?
7461
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
7562

7663
warning: unresolved link to `error`
@@ -84,7 +71,6 @@ LL | #[doc = "single line [error]"]
8471
single line [error]
8572
^^^^^
8673
= note: there is no item named `error` in scope
87-
= help: did you mean to import `error`?
8874
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
8975

9076
warning: unresolved link to `error`
@@ -98,7 +84,6 @@ LL | #[doc = "single line with \"escaping\" [error]"]
9884
single line with "escaping" [error]
9985
^^^^^
10086
= note: there is no item named `error` in scope
101-
= help: did you mean to import `error`?
10287
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
10388

10489
warning: unresolved link to `error`
@@ -114,7 +99,6 @@ LL | | /// [error]
11499
[error]
115100
^^^^^
116101
= note: there is no item named `error` in scope
117-
= help: did you mean to import `error`?
118102
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
119103

120104
warning: unresolved link to `error1`
@@ -123,7 +107,6 @@ warning: unresolved link to `error1`
123107
LL | /// docs [error1]
124108
| ^^^^^^ there is no item named `error1` in scope
125109
|
126-
= help: did you mean to import `error1`?
127110
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
128111

129112
warning: unresolved link to `error2`
@@ -132,7 +115,6 @@ warning: unresolved link to `error2`
132115
LL | /// docs [error2]
133116
| ^^^^^^ there is no item named `error2` in scope
134117
|
135-
= help: did you mean to import `error2`?
136118
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
137119

138120
warning: unresolved link to `BarA`
@@ -141,7 +123,6 @@ warning: unresolved link to `BarA`
141123
LL | /// bar [BarA] bar
142124
| ^^^^ there is no item named `BarA` in scope
143125
|
144-
= help: did you mean to import `BarA`?
145126
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
146127

147128
warning: unresolved link to `BarB`
@@ -150,7 +131,6 @@ warning: unresolved link to `BarB`
150131
LL | * bar [BarB] bar
151132
| ^^^^ there is no item named `BarB` in scope
152133
|
153-
= help: did you mean to import `BarB`?
154134
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
155135

156136
warning: unresolved link to `BarC`
@@ -159,7 +139,6 @@ warning: unresolved link to `BarC`
159139
LL | bar [BarC] bar
160140
| ^^^^ there is no item named `BarC` in scope
161141
|
162-
= help: did you mean to import `BarC`?
163142
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
164143

165144
warning: unresolved link to `BarD`
@@ -173,7 +152,6 @@ LL | #[doc = "Foo\nbar [BarD] bar\nbaz"]
173152
bar [BarD] bar
174153
^^^^
175154
= note: there is no item named `BarD` in scope
176-
= help: did you mean to import `BarD`?
177155
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
178156

179157
warning: unresolved link to `BarF`
@@ -190,7 +168,6 @@ LL | f!("Foo\nbar [BarF] bar\nbaz");
190168
bar [BarF] bar
191169
^^^^
192170
= note: there is no item named `BarF` in scope
193-
= help: did you mean to import `BarF`?
194171
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
195172
= note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
196173

src/test/rustdoc-ui/lint-group.stderr

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ note: the lint level is defined here
4040
LL | #![deny(rustdoc)]
4141
| ^^^^^^^
4242
= note: `#[deny(broken_intra_doc_links)]` implied by `#[deny(rustdoc)]`
43-
= help: did you mean to import `error`?
4443
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
4544

4645
error: aborting due to 3 previous errors

0 commit comments

Comments
 (0)