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

Fix ICE in unnecessary_mut_passed #14065

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lapla-cogito
Copy link
Contributor

fix #12171

changelog: none

@rustbot
Copy link
Collaborator

rustbot commented Jan 23, 2025

r? @Centri3

rustbot has assigned @Centri3.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jan 23, 2025
Copy link
Contributor Author

@lapla-cogito lapla-cogito left a comment

Choose a reason for hiding this comment

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

I suspect (but have no proof) that the cause of this ICE is due to doing something non-trivial. E.g., the following in the original issue:

let mut n = 113383;
while n != 0 {}

I have not been able to add tests because if I include such code as the test, the test will not finish (while I've seen the previous implementation causes ICE🧊), but I'm wondering if it is possible to add test cases that Clippy can validate.

PS, I checked with the following:

fn main() {
    let s = [(); {
        let mut n = 113383;
        while n > 0 {}
        n
    }];
    s.len();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE: src/tools/clippy/clippy_lints/src/mut_reference.rs
3 participants