Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress unused_mut if unused_variables is reported #101977

Closed
wants to merge 2 commits into from

Conversation

sanxiyn
Copy link
Member

@sanxiyn sanxiyn commented Sep 18, 2022

Fix #97074.

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Sep 18, 2022
@rust-highfive
Copy link
Collaborator

r? @nagisa

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 18, 2022
@rust-log-analyzer

This comment has been minimized.

@cjgillot
Copy link
Contributor

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

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

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 19, 2022
@bors
Copy link
Contributor

bors commented Sep 19, 2022

⌛ Trying commit 50f8558 with merge b3d31c22c20e7390b577ec096a8c97ea87df12fa...

@bors
Copy link
Contributor

bors commented Sep 19, 2022

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

@rust-timer
Copy link
Collaborator

Queued b3d31c22c20e7390b577ec096a8c97ea87df12fa with parent 11bb80a, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (b3d31c22c20e7390b577ec096a8c97ea87df12fa): comparison URL.

Overall result: no relevant changes - no action needed

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

Instruction count

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

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean1 range count2
Regressions ❌
(primary)
1.9% [1.8%, 2.1%] 3
Regressions ❌
(secondary)
3.0% [1.0%, 5.2%] 5
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.9% [1.8%, 2.1%] 3

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean1 range count2
Regressions ❌
(primary)
2.4% [2.4%, 2.5%] 2
Regressions ❌
(secondary)
3.3% [3.3%, 3.3%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.4% [2.4%, 2.5%] 2

Footnotes

  1. the arithmetic mean of the percent change 2

  2. number of relevant changes 2

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 19, 2022
@@ -830,7 +830,8 @@ rustc_queries! {
desc { |tcx| "checking privacy in {}", describe_as_module(key, tcx) }
}

query check_liveness(key: DefId) {
query check_liveness(key: DefId) -> Option<FxIndexSet<Span>> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Spans are not a very robust source of information. Do we have a better, more "semantic" source of information?

Copy link
Member Author

@sanxiyn sanxiyn Sep 20, 2022

Choose a reason for hiding this comment

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

I tried, but couldn't find one. Rather, there is a lot on liveness side working on HIR, but they are missing on borrowck side working on MIR, which needs to use this information.

.into_iter()
.map(|(_, _, ident_span)| ident_span)
.collect::<Vec<_>>();
self.unused_variables_spans.borrow_mut().extend(&spans);
Copy link
Contributor

Choose a reason for hiding this comment

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

This will populate unused_variables_spans even if we do not emit an unused_variable lint, if explicitly allowed for instance. This may be surprising, not to have a lint at all in those cases.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right. It is troublesome indeed. I will think about it.

@nagisa
Copy link
Member

nagisa commented Sep 22, 2022

@cjgillot you want to keep reviewing this to the end or should I take a look at this still?

@cjgillot
Copy link
Contributor

I can take it you don't want to keep it.
r? @cjgillot

@rust-highfive rust-highfive assigned cjgillot and unassigned nagisa Sep 22, 2022
@cjgillot cjgillot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 25, 2022
@bors
Copy link
Contributor

bors commented Oct 1, 2022

☔ The latest upstream changes (presumably #101986) made this pull request unmergeable. Please resolve the merge conflicts.

@JohnCSimon
Copy link
Member

@sanxiyn Ping from triage: I'm closing this due to inactivity, Please reopen when you are ready to continue with this.
Note: if you are going to continue please open the PR BEFORE you push to it, else you won't be able to reopen - this is a quirk of github.
Thanks for your contribution.

@rustbot label: +S-inactive

@JohnCSimon JohnCSimon closed this Apr 30, 2023
@rustbot rustbot added the S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. label Apr 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant 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.

Inhibit unused_mut variables if unused_variables is also triggered
9 participants