Commit e9a50b8
authored
Rollup merge of rust-lang#140307 - mejrs:condition_parser, r=nnethercote
Refactor rustc_on_unimplemented's filter parser
Followup to rust-lang#139091; I plan on moving most of this code into `rustc_attr_parsing` at some point, but want to land this separately first.
I have taken care to preserve the original behavior as much as I could:
- All but one of the new error variants are replacements for the ones originally emitted by the cfg parsing machinery; so these errors are not "new".
- the `InvalidFlag` variant is new, this PR turns this (from being ignored and silently doing nothing) into an error:
```rust
#[rustc_on_unimplemented(on(something, message = "y"))]
//~^ ERROR invalid boolean flag
//~^^ NOTE expected one of `crate_local`, `direct` or `from_desugaring`, not `something`
trait InvalidFlag {}
```
This does not occur anywhere except in this test. I couldn't find a way that I liked to keep allowing this or to do nothing, erroring was the cleanest solution.
- There are a bunch of FIXME throughout this and the previous PR, I plan on addressing those in follow up prs..
Finally, this gets rid of the "longest" dependency in rustc:
File tree
8 files changed
+510
-194
lines changed- compiler/rustc_trait_selection
- src
- error_reporting/traits
- tests/ui/on-unimplemented
8 files changed
+510
-194
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4497 | 4497 | | |
4498 | 4498 | | |
4499 | 4499 | | |
4500 | | - | |
4501 | 4500 | | |
4502 | 4501 | | |
4503 | 4502 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | 151 | | |
155 | 152 | | |
156 | 153 | | |
| |||
187 | 184 | | |
188 | 185 | | |
189 | 186 | | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | 187 | | |
194 | 188 | | |
195 | 189 | | |
| |||
237 | 231 | | |
238 | 232 | | |
239 | 233 | | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | 234 | | |
245 | 235 | | |
246 | 236 | | |
| |||
339 | 329 | | |
340 | 330 | | |
341 | 331 | | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
342 | 348 | | |
343 | 349 | | |
344 | 350 | | |
| |||
Lines changed: 23 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | | - | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
24 | | - | |
25 | | - | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
309 | | - | |
| 309 | + | |
310 | 310 | | |
311 | | - | |
312 | | - | |
| 311 | + | |
| 312 | + | |
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
316 | 316 | | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
| |||
427 | 427 | | |
428 | 428 | | |
429 | 429 | | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
442 | 436 | | |
443 | 437 | | |
444 | 438 | | |
| |||
724 | 718 | | |
725 | 719 | | |
726 | 720 | | |
727 | | - | |
| 721 | + | |
728 | 722 | | |
729 | 723 | | |
730 | 724 | | |
| |||
744 | 738 | | |
745 | 739 | | |
746 | 740 | | |
747 | | - | |
| 741 | + | |
748 | 742 | | |
749 | 743 | | |
750 | 744 | | |
| |||
0 commit comments