Skip to content

Support lint expectations for --force-warn lints (RFC 2383) - #97757

Merged
bors merged 1 commit into
rust-lang:masterfrom
xFrednet:rfc-2383-expect-with-force-warn
Jun 16, 2022
Merged

Support lint expectations for --force-warn lints (RFC 2383)#97757
bors merged 1 commit into
rust-lang:masterfrom
xFrednet:rfc-2383-expect-with-force-warn

Conversation

@xFrednet

Copy link
Copy Markdown
Contributor

Rustc has a --force-warn flag, which overrides lint level attributes and forces the diagnostics to always be warn. This means, that for lint expectations, the diagnostic can't be suppressed as usual. This also means that the expectation would not be fulfilled, even if a lint had been triggered in the expected scope.

This PR now also tracks the expectation ID in the ForceWarn level. I've also made some minor adjustments, to possibly catch more bugs and make the whole implementation more robust.

This will probably conflict with #97718. That PR should ideally be reviewed and merged first. The conflict itself will be trivial to fix.


r? @wesleywiser

cc: @flip1995 since you've helped with the initial review and also discussed this topic with me. 🙃

Follow-up of: #87835

Issue: #85549

Yeah, and that's it.

@rust-highfive

Copy link
Copy Markdown
Contributor

Some changes occurred in src/tools/rustfmt.

cc @rust-lang/rustfmt

@rustbotrustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 5, 2022
@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 5, 2022
@xFrednet

This comment was marked as off-topic.

@rustbotrustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 5, 2022
@xFrednet

This comment was marked as off-topic.

@rust-timer

This comment was marked as off-topic.

@bors

This comment was marked as off-topic.

@rust-langrust-lang deleted a comment from rust-timerJun 5, 2022
@bors

bors commented Jun 5, 2022

Copy link
Copy Markdown
Collaborator

☀️ Try build successful - checks-actions
Build commit: 8608dd3a0505ab79dd32b8873a7df850c163b711 (8608dd3a0505ab79dd32b8873a7df850c163b711)

@rust-timer

This comment was marked as off-topic.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (8608dd3a0505ab79dd32b8873a7df850c163b711): comparison url.

Instruction count

  • Primary benchmarks: 🎉 relevant improvement found
  • Secondary benchmarks: no relevant changes found
mean1maxcount2
Regressions 😿
(primary)
N/AN/A0
Regressions 😿
(secondary)
N/AN/A0
Improvements 🎉
(primary)
-0.6%-0.6%1
Improvements 🎉
(secondary)
N/AN/A0
All 😿🎉 (primary)-0.6%-0.6%1

Max RSS (memory usage)

Results
  • Primary benchmarks: 😿 relevant regression found
  • Secondary benchmarks: mixed results
mean1maxcount2
Regressions 😿
(primary)
3.8%3.8%1
Regressions 😿
(secondary)
3.4%4.1%2
Improvements 🎉
(primary)
N/AN/A0
Improvements 🎉
(secondary)
-3.7%-3.7%1
All 😿🎉 (primary)3.8%3.8%1

Cycles

This benchmark run did not return any relevant results for this metric.

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf -perf-regression

Footnotes

  1. the arithmetic mean of the percent change2

  2. number of relevant changes2

@rustbotrustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 5, 2022
@rust-timer

Copy link
Copy Markdown
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbotrustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 5, 2022
@xFrednet

xFrednet commented Jun 5, 2022

Copy link
Copy Markdown
ContributorAuthor

It looks like hiding the comment triggered rust-timer again. :/

@xFrednet
xFrednetforce-pushed the rfc-2383-expect-with-force-warn branch from 61a746c to ebbe09cCompareJune 10, 2022 18:59
@xFrednet

Copy link
Copy Markdown
ContributorAuthor

Alright, I've rebased on master. This PR should also be ready for review now. The performance run should still be valid.

As a side note, I love how stable the CI is. I can just rebase on master and expect everything to be green. This is so beautiful!

@flip1995flip1995 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only a few comments about the documentation and a missing test. Impl LGTM

Comment threadcompiler/rustc_errors/src/lib.rs Outdated
Comment threadcompiler/rustc_lint/src/levels.rs Outdated
Comment threadcompiler/rustc_lint/src/levels.rs Outdated
@xFrednet
xFrednetforce-pushed the rfc-2383-expect-with-force-warn branch from ebbe09c to 16ecd42CompareJune 14, 2022 05:41
@xFrednet

Copy link
Copy Markdown
ContributorAuthor

Nice catches, thank you for the review @flip1995!

@flip1995flip1995 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Since it touches the compiler I'll leave the final r+ to Wesley again.

@wesleywiserwesleywiser left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

r=me with that one nit addressed

Comment threadcompiler/rustc_lint/src/levels.rs Outdated
@xFrednet
xFrednetforce-pushed the rfc-2383-expect-with-force-warn branch from 16ecd42 to 8527a3dCompareJune 16, 2022 06:17
@xFrednet

Copy link
Copy Markdown
ContributorAuthor

Awesome, thank you for the review! I think we have two smaller things that need to be updated, and then this feature should be complete 🥳

@bors r=wesleywiser,flip1995 rollup=always

@bors

bors commented Jun 16, 2022

Copy link
Copy Markdown
Collaborator

📌 Commit 8527a3d has been approved by wesleywiser,flip1995

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 16, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 16, 2022
…askrgr
Rollup of 4 pull requests
Successful merges:
- rust-lang#97757 (Support lint expectations for `--force-warn` lints (RFC 2383))
- rust-lang#98125 (Entry and_modify doc)
- rust-lang#98137 (debuginfo: Fix NatVis for Rc and Arc with unsized pointees.)
- rust-lang#98147 (Make #[cfg(bootstrap)] not error in proc macros on later stages )
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit 95be954 into rust-lang:masterJun 16, 2022
@rustbotrustbot added this to the 1.63.0 milestone Jun 16, 2022
@xFrednet
xFrednet deleted the rfc-2383-expect-with-force-warn branch June 16, 2022 10:16
calebcartwright pushed a commit to calebcartwright/rust that referenced this pull request Jun 23, 2022
…-warn, r=wesleywiser,flip1995
Support lint expectations for `--force-warn` lints (RFC 2383)
Rustc has a `--force-warn` flag, which overrides lint level attributes and forces the diagnostics to always be warn. This means, that for lint expectations, the diagnostic can't be suppressed as usual. This also means that the expectation would not be fulfilled, even if a lint had been triggered in the expected scope.
This PR now also tracks the expectation ID in the `ForceWarn` level. I've also made some minor adjustments, to possibly catch more bugs and make the whole implementation more robust.
This will probably conflict with rust-lang#97718. That PR should ideally be reviewed and merged first. The conflict itself will be trivial to fix.
---
r? `@wesleywiser`
cc: `@flip1995` since you've helped with the initial review and also discussed this topic with me. 🙃
Follow-up of: rust-lang#87835
Issue: rust-lang#85549
Yeah, and that's it.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.S-waiting-on-perfStatus: Waiting on a perf run to be completed.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@xFrednet@rust-highfive@rust-timer@bors@wesleywiser@flip1995@rustbot