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 redundant_locals #11623

Merged
merged 1 commit into from Oct 6, 2023
Merged

Fix ice in redundant_locals #11623

merged 1 commit into from Oct 6, 2023

Conversation

koka831
Copy link
Contributor

@koka831 koka831 commented Oct 6, 2023

Fixes #11619

Rebinding over macro like the code below, idents will be different (x#4 and x#0 in that case).

fn reassign_in_macro() {
  let x = 10;
  macro_rules! mac {
    ($i:ident) => {
      let mut x = x;
    }
  }
  mac!(y);
}

It causes unwrapping None.

fn find_binding(pat: &Pat<'_>, name: Ident) -> Option<BindingAnnotation> {
let mut ret = None;
pat.each_binding_or_first(&mut |annotation, _, _, ident| {
if ident == name {
ret = Some(annotation);
}
});
ret
}

changelog: ICE: [redundant_locals]: No longer lints rebinding over macro

@rustbot
Copy link
Collaborator

rustbot commented Oct 6, 2023

r? @llogiq

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Oct 6, 2023
@koka831 koka831 changed the title Fix ice Fix ice in redundant_locals Oct 6, 2023
@bors
Copy link
Collaborator

bors commented Oct 6, 2023

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

@llogiq
Copy link
Contributor

llogiq commented Oct 6, 2023

Thank you! @bors r+

@bors
Copy link
Collaborator

bors commented Oct 6, 2023

📌 Commit 3363f7c has been approved by llogiq

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Oct 6, 2023

🔒 Merge conflict

This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again.

How do I rebase?

Assuming self is your fork and upstream is this repository, you can resolve the conflict following these steps:

  1. git checkout fix/11619 (switch to your branch)
  2. git fetch upstream master (retrieve the latest master)
  3. git rebase upstream/master -p (rebase on top of it)
  4. Follow the on-screen instruction to resolve conflicts (check git status if you got lost).
  5. git push self fix/11619 --force-with-lease (update this PR)

You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial.

Please avoid the "Resolve conflicts" button on GitHub. It uses git merge instead of git rebase which makes the PR commit history more difficult to read.

Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Cargo.lock conflict is handled during merge and rebase. This is normal, and you should still perform step 5 to update this PR.

Error message
Auto-merging tests/ui/redundant_locals.stderr
CONFLICT (content): Merge conflict in tests/ui/redundant_locals.stderr
Auto-merging clippy_lints/src/redundant_locals.rs
Automatic merge failed; fix conflicts and then commit the result.

@koka831
Copy link
Contributor Author

koka831 commented Oct 6, 2023

@llogiq sorry, I've just rebased and resolve conflict. Could you check it again please?

@llogiq
Copy link
Contributor

llogiq commented Oct 6, 2023

No need to be sorry, I had overlooked the conflict.

Let's try again.

@bors r+

@bors
Copy link
Collaborator

bors commented Oct 6, 2023

📌 Commit 68d2082 has been approved by llogiq

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Oct 6, 2023

⌛ Testing commit 68d2082 with merge 3662bd8...

@bors
Copy link
Collaborator

bors commented Oct 6, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: llogiq
Pushing 3662bd8 to master...

@bors bors merged commit 3662bd8 into rust-lang:master Oct 6, 2023
5 checks passed
@koka831 koka831 deleted the fix/11619 branch October 7, 2023 13:39
@y21 y21 mentioned this pull request Oct 10, 2023
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 in redundant_locals check
4 participants