Rewrite the #[repr] attribute parser#157125
Conversation
|
Some changes occurred in compiler/rustc_attr_parsing |
| cx.adcx().expected_specific_argument( | ||
| param.span(), | ||
| &[ | ||
| sym::align, |
There was a problem hiding this comment.
One thing that still annoys me is that in a lot of attribute parsers have these match statements, and then we need to list all branches of the match statement again for the expected_specific_argument error
There was a problem hiding this comment.
I'd like a solution where these symbols are only listed once.
Maybe make an array of [(Symbol, constructor); _] (or maybe [(Symbol, checker, constructor); _]) and if you don't find the symbol in the array, do something like array.iter().map(|x|x.0).collect() and pass that to expected_specific_argument.
See
rust/compiler/rustc_resolve/src/macros.rs
Line 716 in 6368fd5
There was a problem hiding this comment.
(let's leave this for a separate PR tho, since this affects more places that I'd like to fix at the same time)
| cx.adcx().expected_specific_argument( | ||
| param.span(), | ||
| &[ | ||
| sym::align, |
There was a problem hiding this comment.
I'd like a solution where these symbols are only listed once.
Maybe make an array of [(Symbol, constructor); _] (or maybe [(Symbol, checker, constructor); _]) and if you don't find the symbol in the array, do something like array.iter().map(|x|x.0).collect() and pass that to expected_specific_argument.
See
rust/compiler/rustc_resolve/src/macros.rs
Line 716 in 6368fd5
|
Does this conflict with #157036 ? |
f4e215b to
7aef596
Compare
…uwer Rollup of 8 pull requests Successful merges: - #156863 (Make hint::cold_path #[cold] so that it works even if the MIR inliner can't inline it) - #156875 (Correct and document semantics of `yield` terminator) - #157115 ([rustdoc] Fix foreign items macro expansion) - #157150 (Revert "drop derive helpers during ast lowering" ) - #156887 (Rename `-Zdebuginfo-for-profiling` switch) - #157039 (rustdoc: correctly propagate cfgs for glob reexports) - #157125 (Rewrite the `#[repr]` attribute parser) - #157154 (Revert workaround used to select the gcc codegen in the coretests CI)
Rollup merge of #157125 - JonathanBrouwer:repr-target-checking2, r=mejrs Rewrite the `#[repr]` attribute parser The `#[repr]` attribute parser was one of the first attribute parsers we made, and didn't use a lot of the awesome infra we have nowadays yet, so in preparation for a new approach I'm trying for #156569 I decided to clean it up. This PR should have no observable effect other than improved diagnostic messages. r? @mejrs
|
@rust-timer build e5f1fe2 Testing for #157161. |
|
Missing artifact for sha |
|
@rust-timer build e5f1fe2 |
|
Missing artifact for sha |
|
@rust-timer build e5f1fe2 |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (e5f1fe2): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)This perf run didn't have relevant results for this metric. CyclesResults (secondary 3.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 515.367s -> 514.529s (-0.16%) |
The
#[repr]attribute parser was one of the first attribute parsers we made, and didn't use a lot of the awesome infra we have nowadays yet, so in preparation for a new approach I'm trying for #156569 I decided to clean it up.This PR should have no observable effect other than improved diagnostic messages.
r? @mejrs