Skip to content

fix: handle ref mut bindings in contains_explicit_ref_binding#21647

Merged
ChayimFriedman2 merged 1 commit intorust-lang:masterfrom
Albab-Hasan:fix/contains-explicit-ref-binding-missing-refmut
Feb 15, 2026
Merged

fix: handle ref mut bindings in contains_explicit_ref_binding#21647
ChayimFriedman2 merged 1 commit intorust-lang:masterfrom
Albab-Hasan:fix/contains-explicit-ref-binding-missing-refmut

Conversation

@Albab-Hasan
Copy link
Contributor

the standalone contains_explicit_ref_binding function only checked for BindingAnnotation::Ref, missing BindingAnnotation::RefMut. this caused let ref mut x = expr to incorrectly take the coercion path instead of preserving the exact type of the rhs expression. the method version used for match arms already handles both Ref and RefMut correctly.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 14, 2026
@ChayimFriedman2
Copy link
Contributor

Can you add a test?

@Albab-Hasan
Copy link
Contributor Author

@ChayimFriedman2 ok

the standalone `contains_explicit_ref_binding` function only checked for
`BindingAnnotation::Ref`, missing `BindingAnnotation::RefMut`. this caused
`let ref mut x = expr` to incorrectly take the coercion path instead of
preserving the exact type of the rhs expression. the method version used
for match arms already handles both `Ref` and `RefMut` correctly.
@Albab-Hasan Albab-Hasan force-pushed the fix/contains-explicit-ref-binding-missing-refmut branch from a4f1362 to a78e873 Compare February 14, 2026 22:21
@Albab-Hasan
Copy link
Contributor Author

@ChayimFriedman2 hey, is this good? pls let me know.

Copy link
Contributor

@ChayimFriedman2 ChayimFriedman2 left a comment

Choose a reason for hiding this comment

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

Thanks!

@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue Feb 15, 2026
@Albab-Hasan
Copy link
Contributor Author

@ChayimFriedman2 hey is there anyway I can ask you some questions if you dont mind?

Merged via the queue into rust-lang:master with commit b03c842 Feb 15, 2026
16 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 15, 2026
@ChayimFriedman2
Copy link
Contributor

On Zulip is a good idea.

@Albab-Hasan
Copy link
Contributor Author

@ChayimFriedman2 ok, do you have a org or smth?

@ShoyuVanilla
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments