Commit 7556236
committed
Handle
`Path<>` needs to be distinguished from `Path<T>`. This commit does
that.
Also, `maybe_insert_elided_lifetimes_in_path` now does a little more
span shrinkage so all the spans it produces are empty and point to the
lifetime insertion point. As a result, `suggestion` no longer needs to
do any span shrinking.
All this improves some error messages. First, on the `Path` case, we
have this diff:
```
LL | fn f(_: impl Foo) {}
- | ^^^ expected named lifetime parameter
+ | ^ expected named lifetime parameter
```
The carets now point to where the named lifetime parameter must be
inserted, as per the subsequent suggestion:
```
LL | fn f<'a>(_: impl Foo<'a>) {}
| ++++ ++++
```
Similar story on this diff on the `Path<>` case:
```
LL | fn f(_: impl Foo<>) {}
- | ^ expected named lifetime parameter
+ | ^ expected named lifetime parameter
```
Plus we now print the `Path<>` suggestion properly:
```
-LL - fn f(_: impl Foo<>) {}
-LL + fn f<'a>(_: impl Foo'a, >) {}
- |
+LL | fn f<'a>(_: impl Foo<'a, >) {}
+ | ++++ +++
```Path<> better in error messages.1 parent cae5ecb commit 7556236
File tree
4 files changed
+58
-42
lines changed- compiler
- rustc_ast_lowering/src
- rustc_hir/src
- tests/ui/suggestions
4 files changed
+58
-42
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
58 | | - | |
| 57 | + | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| |||
1081 | 1081 | | |
1082 | 1082 | | |
1083 | 1083 | | |
1084 | | - | |
| 1084 | + | |
1085 | 1085 | | |
1086 | 1086 | | |
1087 | 1087 | | |
| |||
1773 | 1773 | | |
1774 | 1774 | | |
1775 | 1775 | | |
1776 | | - | |
| 1776 | + | |
1777 | 1777 | | |
1778 | 1778 | | |
1779 | 1779 | | |
1780 | 1780 | | |
1781 | 1781 | | |
1782 | | - | |
| 1782 | + | |
1783 | 1783 | | |
1784 | 1784 | | |
1785 | 1785 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
432 | 432 | | |
433 | 433 | | |
434 | 434 | | |
435 | | - | |
436 | | - | |
| 435 | + | |
| 436 | + | |
437 | 437 | | |
438 | 438 | | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
443 | 446 | | |
444 | | - | |
445 | | - | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
446 | 456 | | |
447 | 457 | | |
448 | 458 | | |
449 | 459 | | |
450 | 460 | | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
| 461 | + | |
| 462 | + | |
456 | 463 | | |
457 | 464 | | |
458 | 465 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
38 | 48 | | |
39 | 49 | | |
40 | 50 | | |
41 | 51 | | |
42 | 52 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
50 | 56 | | |
51 | 57 | | |
52 | 58 | | |
| |||
304 | 310 | | |
305 | 311 | | |
306 | 312 | | |
307 | | - | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
308 | 319 | | |
309 | 320 | | |
310 | 321 | | |
311 | 322 | | |
312 | | - | |
313 | | - | |
| 323 | + | |
| 324 | + | |
314 | 325 | | |
315 | 326 | | |
316 | 327 | | |
| |||
Lines changed: 12 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
215 | | - | |
| 215 | + | |
216 | 216 | | |
217 | 217 | | |
218 | | - | |
| 218 | + | |
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
228 | | - | |
| 228 | + | |
229 | 229 | | |
230 | 230 | | |
231 | | - | |
| 231 | + | |
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
| |||
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
241 | | - | |
| 241 | + | |
242 | 242 | | |
243 | 243 | | |
244 | | - | |
| 244 | + | |
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
250 | | - | |
251 | | - | |
252 | | - | |
| 250 | + | |
| 251 | + | |
253 | 252 | | |
254 | 253 | | |
255 | | - | |
| 254 | + | |
256 | 255 | | |
257 | 256 | | |
258 | | - | |
| 257 | + | |
259 | 258 | | |
260 | 259 | | |
261 | 260 | | |
262 | 261 | | |
263 | 262 | | |
264 | | - | |
265 | | - | |
266 | | - | |
| 263 | + | |
| 264 | + | |
267 | 265 | | |
268 | 266 | | |
269 | 267 | | |
| |||
0 commit comments