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 binder handling in unnecessary_to_owned #11953

Merged
merged 1 commit into from
Dec 13, 2023
Merged

Conversation

Jarcho
Copy link
Contributor

@Jarcho Jarcho commented Dec 11, 2023

fixes #11952

The use of rebind instead of EarlyBinder::bind isn't technically needed, but it is the semantically correct operation.

changelog: None

@rustbot
Copy link
Collaborator

rustbot commented Dec 11, 2023

r? @Alexendoo

(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 Dec 11, 2023
@Jarcho Jarcho added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Dec 11, 2023
@Alexendoo
Copy link
Member

👍 @bors r+

@bors
Copy link
Collaborator

bors commented Dec 13, 2023

📌 Commit 27c5b21 has been approved by Alexendoo

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Dec 13, 2023

⌛ Testing commit 27c5b21 with merge 29bdc8b...

@bors
Copy link
Collaborator

bors commented Dec 13, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: Alexendoo
Pushing 29bdc8b to master...

@bors bors merged commit 29bdc8b into rust-lang:master Dec 13, 2023
5 checks passed
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 21, 2023
…troalbini

[beta] Clippy beta backport

PR towards stable, as beta was branched a day early and I missed the notification.

- rust-lang/rust-clippy#11538
- rust-lang/rust-clippy#11756
- rust-lang/rust-clippy#11760
- rust-lang/rust-clippy#11953

r? `@pietroalbini`
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 21, 2023
…troalbini

[beta] Clippy beta backport

PR towards stable, as beta was branched a day early and I missed the notification.

- rust-lang/rust-clippy#11538
- rust-lang/rust-clippy#11756
- rust-lang/rust-clippy#11760
- rust-lang/rust-clippy#11953

r? `@pietroalbini`
@smoelius
Copy link
Contributor

The use of rebind instead of EarlyBinder::bind isn't technically needed, but it is the semantically correct operation.

I think I've seen you make similar comments before (though I can't seem to find them).

When is rebind necessary? Or where do I read about when rebind is necessary?

@Jarcho
Copy link
Contributor Author

Jarcho commented Dec 29, 2023

A binder is a combination of the list of variables which have yet to be bound, and an item which contains those variables (e.g. a type). As a rough guide to the two functions; rebind is used to create a new binder with the same list of variables as another, and bind would be used when a new list of variables is being applied. This makes rebind an alternative to map when that gets complicated/impossible to use.

For EarlyBinder, bind doesn't require a bound variable list so using it when rebind should be used will make it harder to transition to actually storing the variable list if that ever becomes a thing. Binder::bind actually requires a bound variable list so this isn't as much of a problem there.

@smoelius
Copy link
Contributor

For EarlyBinder, bind doesn't require a bound variable list so using it when rebind should be used will make it harder to transition to actually storing the variable list if that ever becomes a thing.

Makes perfect sense. Thanks!

@flip1995 flip1995 added beta-accepted Accepted for backporting to the compiler in the beta channel. and removed beta-nominated Nominated for backporting to the compiler in the beta channel. labels Jan 4, 2024
@xFrednet xFrednet removed the beta-accepted Accepted for backporting to the compiler in the beta channel. label Mar 18, 2024
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 clippy]: 'rustc' panicked at compiler/rustc_infer/src/infer/at.rs:453:17
7 participants