Skip to content

Commit aa97280

Browse files
committed
Show diff suggestion format on verbose replacement
``` error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/attempted-access-non-fatal.rs:7:15 | LL | let _ = 2.l; | ^ | help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix | LL - let _ = 2.l; LL + let _ = 2.0f64; | ```
1 parent 56b3083 commit aa97280

File tree

759 files changed

+6127
-4052
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

759 files changed

+6127
-4052
lines changed

compiler/rustc_errors/src/emitter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1807,7 +1807,7 @@ impl HumanEmitter {
18071807
for (complete, parts, highlights, _) in suggestions.iter().take(MAX_SUGGESTIONS) {
18081808
debug!(?complete, ?parts, ?highlights);
18091809

1810-
let has_deletion = parts.iter().any(|p| p.is_deletion(sm));
1810+
let has_deletion = parts.iter().any(|p| p.is_deletion(sm) || p.is_replacement(sm));
18111811
let is_multiline = complete.lines().count() > 1;
18121812

18131813
if let Some(span) = span.primary_span() {

tests/rustdoc-ui/intra-doc/disambiguator-mismatch.stderr

+27-18
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ LL | #![deny(rustdoc::broken_intra_doc_links)]
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212
help: to link to the enum, prefix with `enum@`
1313
|
14-
LL | /// Link to [enum@S]
15-
| ~~~~~
14+
LL - /// Link to [struct@S]
15+
LL + /// Link to [enum@S]
16+
|
1617

1718
error: incompatible link kind for `S`
1819
--> $DIR/disambiguator-mismatch.rs:21:14
@@ -22,8 +23,9 @@ LL | /// Link to [mod@S]
2223
|
2324
help: to link to the enum, prefix with `enum@`
2425
|
25-
LL | /// Link to [enum@S]
26-
| ~~~~~
26+
LL - /// Link to [mod@S]
27+
LL + /// Link to [enum@S]
28+
|
2729

2830
error: incompatible link kind for `S`
2931
--> $DIR/disambiguator-mismatch.rs:26:14
@@ -33,8 +35,9 @@ LL | /// Link to [union@S]
3335
|
3436
help: to link to the enum, prefix with `enum@`
3537
|
36-
LL | /// Link to [enum@S]
37-
| ~~~~~
38+
LL - /// Link to [union@S]
39+
LL + /// Link to [enum@S]
40+
|
3841

3942
error: incompatible link kind for `S`
4043
--> $DIR/disambiguator-mismatch.rs:31:14
@@ -44,8 +47,9 @@ LL | /// Link to [trait@S]
4447
|
4548
help: to link to the enum, prefix with `enum@`
4649
|
47-
LL | /// Link to [enum@S]
48-
| ~~~~~
50+
LL - /// Link to [trait@S]
51+
LL + /// Link to [enum@S]
52+
|
4953

5054
error: incompatible link kind for `T`
5155
--> $DIR/disambiguator-mismatch.rs:36:14
@@ -55,8 +59,9 @@ LL | /// Link to [struct@T]
5559
|
5660
help: to link to the trait, prefix with `trait@`
5761
|
58-
LL | /// Link to [trait@T]
59-
| ~~~~~~
62+
LL - /// Link to [struct@T]
63+
LL + /// Link to [trait@T]
64+
|
6065

6166
error: incompatible link kind for `m`
6267
--> $DIR/disambiguator-mismatch.rs:41:14
@@ -89,8 +94,9 @@ LL | /// Link to [const@s]
8994
|
9095
help: to link to the static, prefix with `static@`
9196
|
92-
LL | /// Link to [static@s]
93-
| ~~~~~~~
97+
LL - /// Link to [const@s]
98+
LL + /// Link to [static@s]
99+
|
94100

95101
error: incompatible link kind for `c`
96102
--> $DIR/disambiguator-mismatch.rs:57:14
@@ -100,8 +106,9 @@ LL | /// Link to [static@c]
100106
|
101107
help: to link to the constant, prefix with `const@`
102108
|
103-
LL | /// Link to [const@c]
104-
| ~~~~~~
109+
LL - /// Link to [static@c]
110+
LL + /// Link to [const@c]
111+
|
105112

106113
error: incompatible link kind for `c`
107114
--> $DIR/disambiguator-mismatch.rs:62:14
@@ -111,8 +118,9 @@ LL | /// Link to [fn@c]
111118
|
112119
help: to link to the constant, prefix with `const@`
113120
|
114-
LL | /// Link to [const@c]
115-
| ~~~~~~
121+
LL - /// Link to [fn@c]
122+
LL + /// Link to [const@c]
123+
|
116124

117125
error: incompatible link kind for `c`
118126
--> $DIR/disambiguator-mismatch.rs:67:14
@@ -146,8 +154,9 @@ LL | /// Link to [fn@std]
146154
|
147155
help: to link to the crate, prefix with `mod@`
148156
|
149-
LL | /// Link to [mod@std]
150-
| ~~~~
157+
LL - /// Link to [fn@std]
158+
LL + /// Link to [mod@std]
159+
|
151160

152161
error: aborting due to 13 previous errors
153162

tests/rustdoc-ui/intra-doc/field-ice.stderr

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ LL | #![deny(rustdoc::broken_intra_doc_links)]
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212
help: to link to the field, remove the disambiguator
1313
|
14-
LL | /// [`Foo::bar`]
15-
| ~~~~~~~~
14+
LL - /// [`Foo::bar()`]
15+
LL + /// [`Foo::bar`]
16+
|
1617

1718
error: aborting due to 1 previous error
1819

tests/rustdoc-ui/intra-doc/incompatible-primitive-disambiguator.stderr

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ LL | #![deny(rustdoc::broken_intra_doc_links)]
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212
help: to link to the associated constant, prefix with `const@`
1313
|
14-
LL | //! [const@u8::MIN]
15-
| ~~~~~~
14+
LL - //! [static@u8::MIN]
15+
LL + //! [const@u8::MIN]
16+
|
1617

1718
error: aborting due to 1 previous error
1819

tests/rustdoc-ui/intra-doc/prim-conflict.stderr

+12-8
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ LL | /// [type@char]
2626
|
2727
help: to link to the module, prefix with `mod@`
2828
|
29-
LL | /// [mod@char]
30-
| ~~~~
29+
LL - /// [type@char]
30+
LL + /// [mod@char]
31+
|
3132
help: to link to the primitive type, prefix with `prim@`
3233
|
33-
LL | /// [prim@char]
34-
| ~~~~~
34+
LL - /// [type@char]
35+
LL + /// [prim@char]
36+
|
3537

3638
error: incompatible link kind for `char`
3739
--> $DIR/prim-conflict.rs:19:6
@@ -41,8 +43,9 @@ LL | /// [struct@char]
4143
|
4244
help: to link to the module, prefix with `mod@`
4345
|
44-
LL | /// [mod@char]
45-
| ~~~~
46+
LL - /// [struct@char]
47+
LL + /// [mod@char]
48+
|
4649

4750
error: incompatible link kind for `char`
4851
--> $DIR/prim-conflict.rs:26:10
@@ -52,8 +55,9 @@ LL | //! [struct@char]
5255
|
5356
help: to link to the primitive type, prefix with `prim@`
5457
|
55-
LL | //! [prim@char]
56-
| ~~~~~
58+
LL - //! [struct@char]
59+
LL + //! [prim@char]
60+
|
5761

5862
error: aborting due to 4 previous errors
5963

tests/rustdoc-ui/intra-doc/weird-syntax.stderr

+21-14
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ LL | #![deny(rustdoc::broken_intra_doc_links)]
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212
help: to link to the trait, prefix with `trait@`
1313
|
14-
LL | /// [`trait@Clone`]
15-
| ~~~~~~
14+
LL - /// [`struct@Clone`]
15+
LL + /// [`trait@Clone`]
16+
|
1617

1718
error: incompatible link kind for `Clone`
1819
--> $DIR/weird-syntax.rs:21:9
@@ -22,8 +23,9 @@ LL | /// [```struct@Clone```]
2223
|
2324
help: to link to the trait, prefix with `trait@`
2425
|
25-
LL | /// [```trait@Clone```]
26-
| ~~~~~~
26+
LL - /// [```struct@Clone```]
27+
LL + /// [```trait@Clone```]
28+
|
2729

2830
error: incompatible link kind for `Clone`
2931
--> $DIR/weird-syntax.rs:24:11
@@ -33,8 +35,9 @@ LL | /// [ ` struct@Clone ` ]
3335
|
3436
help: to link to the trait, prefix with `trait@`
3537
|
36-
LL | /// [ ` trait@Clone ` ]
37-
| ~~~~~~
38+
LL - /// [ ` struct@Clone ` ]
39+
LL + /// [ ` trait@Clone ` ]
40+
|
3841

3942
error: unresolved link to `Clone`
4043
--> $DIR/weird-syntax.rs:27:9
@@ -104,8 +107,9 @@ LL | /// [x][ struct@Clone]
104107
|
105108
help: to link to the trait, prefix with `trait@`
106109
|
107-
LL | /// [x][ trait@Clone]
108-
| ~~~~~~
110+
LL - /// [x][ struct@Clone]
111+
LL + /// [x][ trait@Clone]
112+
|
109113

110114
error: incompatible link kind for `Clone`
111115
--> $DIR/weird-syntax.rs:65:9
@@ -115,8 +119,9 @@ LL | /// [x][struct@Clone ]
115119
|
116120
help: to link to the trait, prefix with `trait@`
117121
|
118-
LL | /// [x][trait@Clone ]
119-
| ~~~~~~
122+
LL - /// [x][struct@Clone ]
123+
LL + /// [x][trait@Clone ]
124+
|
120125

121126
error: unresolved link to `Clone`
122127
--> $DIR/weird-syntax.rs:74:9
@@ -158,8 +163,9 @@ LL | /// [w]( struct@Clone)
158163
|
159164
help: to link to the trait, prefix with `trait@`
160165
|
161-
LL | /// [w]( trait@Clone)
162-
| ~~~~~~
166+
LL - /// [w]( struct@Clone)
167+
LL + /// [w]( trait@Clone)
168+
|
163169

164170
error: incompatible link kind for `Clone`
165171
--> $DIR/weird-syntax.rs:94:9
@@ -169,8 +175,9 @@ LL | /// [w](struct@Clone )
169175
|
170176
help: to link to the trait, prefix with `trait@`
171177
|
172-
LL | /// [w](trait@Clone )
173-
| ~~~~~~
178+
LL - /// [w](struct@Clone )
179+
LL + /// [w](trait@Clone )
180+
|
174181

175182
error: unresolved link to `Clone`
176183
--> $DIR/weird-syntax.rs:97:9

tests/rustdoc-ui/issues/issue-102986.stderr

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ LL | y: (typeof("hey"),),
66
|
77
help: consider replacing `typeof(...)` with an actual type
88
|
9-
LL | y: (&str,),
10-
| ~~~~
9+
LL - y: (typeof("hey"),),
10+
LL + y: (&str,),
11+
|
1112

1213
error: aborting due to 1 previous error
1314

tests/rustdoc-ui/issues/issue-105742.stderr

+3-2
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,9 @@ LL | | > {
325325
| |__^ ...because it uses `Self` as a type parameter
326326
help: consider using an opaque type instead
327327
|
328-
LL | pub fn next<'a, T>(s: &'a mut impl SVec<Item = T, Output = T>) {
329-
| ~~~~
328+
LL - pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) {
329+
LL + pub fn next<'a, T>(s: &'a mut impl SVec<Item = T, Output = T>) {
330+
|
330331

331332
error[E0107]: missing generics for associated type `SVec::Item`
332333
--> $DIR/issue-105742.rs:15:21

tests/rustdoc-ui/issues/issue-120444-1.stderr

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ LL | #![deny(rustdoc::redundant_explicit_links)]
1515
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1616
help: remove explicit link target
1717
|
18-
LL | /// [`Vfs`]
19-
| ~~~~~~~
18+
LL - /// [`Vfs`][crate::Vfs]
19+
LL + /// [`Vfs`]
20+
|
2021

2122
error: aborting due to 1 previous error
2223

tests/rustdoc-ui/issues/issue-120444-2.stderr

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ LL | #![deny(rustdoc::redundant_explicit_links)]
1515
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1616
help: remove explicit link target
1717
|
18-
LL | /// [`Vfs`]
19-
| ~~~~~~~
18+
LL - /// [`Vfs`][crate::Vfs]
19+
LL + /// [`Vfs`]
20+
|
2021

2122
error: aborting due to 1 previous error
2223

0 commit comments

Comments
 (0)