-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Made ref pattern bindings correctly pick Deref or DerefMut #26058
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
Conversation
r? @brson (rust_highfive has picked a reviewer for you, use r? to override) |
cc @eddyb |
r+ modulo the two nits |
@nikomatsakis re the tests: I only realized after I wrote them that I did an unnecessary amount of duplication. If I'd used a I'll change that, plus the |
@nikomatsakis There is a subtle reason for not having |
Fwiw, I just added the |
Added LvaluePreference::from_mutbl Closes rust-lang#15609
@nikomatsakis: Okay, I addressed both nits.
|
@bors r+ nice! |
📌 Commit d6b7ca0 has been approved by |
@eddyb true, the name is somewhat misleading. |
let mut result = false; | ||
/// Checks if the pattern contains any `ref` or `ref mut` bindings, | ||
/// and if yes wether its containing mutable ones or just immutables ones. | ||
pub fn pat_contains_ref_binding(dm: &DefMap, pat: &ast::Pat) -> Option<ast::Mutability> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming issue: the name of the function still implies it's a predicate function but now it returns an Option. Same below.
Closes #15609