Repository navigation
Don't emit diagnostics during pre-expansion lint attribute parsing - #164898
JonathanBrouwer wants to merge 2 commits into
Conversation
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Don't emit diagnostics during early lint attribute parsing
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (9509e76): 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. @bors rollup=iffy rustc-perf Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 0.3%, secondary -0.8%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 0.4%, secondary 0.5%)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: 487.351s -> 487.992s (0.13%) |
This comment has been minimized.
This comment has been minimized.
0807391 to
76f6ef4
Compare
|
This needs a @rust-lang/lang FCP. |
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Don't emit diagnostics during early lint attribute parsing
f745875 to
c1098ff
Compare
This comment has been minimized.
This comment has been minimized.
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Don't emit diagnostics during pre-expansion lint attribute parsing
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (322e491): comparison URL. Overall result: ❌✅ regressions and improvements - please read:Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. Next, please: If you can, justify the regressions found in this try perf run in writing along with @bors rollup=iffy rustc-perf Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (secondary -1.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 0.6%)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: 460.582s -> 460.016s (-0.12%) |
|
The changes to unicode-normalization-0.1.24 and next-solver-stress are all noise |
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Don't emit diagnostics during pre-expansion lint attribute parsing
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (2a887ad): comparison URL. Overall result: ❌✅ regressions and improvements - please read:Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. Next, please: If you can, justify the regressions found in this try perf run in writing along with @bors rollup=iffy rustc-perf Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -0.0%, secondary -3.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 1.7%)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: 460.809s -> 458.49s (-0.50%) |
This comment has been minimized.
This comment has been minimized.
`AttrErrorGuaranteed` represents that `ShouldEmit::emit_err` was called, which may or may not represent an actual diagnostic being emitted. This new type is needed to remove the unchecked `ErrorGuaranteed` when emitting `ShouldEmit::NothingNoBug`.
c1098ff to
bdc9a8d
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
☔ The latest upstream changes made this pull request unmergeable. Please resolve the merge conflicts by rebasing. |
View all comments
Language change
The lint-check attributes have meaning pre-expansion, for pre-expansion linting. For example:
In Rust, attributes that only exist pre-expansion are not required to be semantically valid though, for example:
However, the implementation of this has an inconsistency where invalid lint attributes sometimes emit errors.
This specifically happens when the meta item representing a lint is given an argument list, for example:
This PR fixes this inconsistency, such that lint attributes that only exist pre-expansion never emit errors.
After this PR example 3 will compile, making it consistent with example 2.
This PR implements a small part of the proposal of When do attributes gain semantic meaning?.
Implementation details
This PR introduces a new variant
ShouldEmit::NothingNoBugsuch that an attribute parser can be called without emitting diagnostics or delayed bugs. To achieve this, we use theAttrErrorGuaranteedtype, which is similar toErrorGuaranteed.AttrErrorGuaranteedrepresents thatShouldEmit::emit_errwas called, which may or may not represent an actual diagnostic being emitted, because attributes parsed pre-expansion should not emit diagnostics.This PR interacts with #165049. If that PR is merged, the second commit which introduces
ShouldEmit::NothingNoBugcan be reverted.r? @mejrs