-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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: replace_filter_map_next_with_find_map shouldn't work for dyn trait #16647
fix: replace_filter_map_next_with_find_map shouldn't work for dyn trait #16647
Conversation
d9dedbd
to
0978d16
Compare
self.diagnostics.push(BodyValidationDiagnostic::ReplaceFilterMapNextWithFindMap { | ||
method_call_expr: call_id, | ||
}); | ||
} | ||
|
||
let receiver_ty = self.infer[*receiver].strip_references().clone(); |
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.
Why are we stripping it here? If this is due to coercions and autoref then we should check the adjustments:
let coerced = self.infer
.expr_adjustments
.get(receiver)
.and_then(|adjusts| adjusts.last().map(|adjust| adjust.target.clone()));
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.
Ah nvm you want to get the dyn trait, then we should do the stripping where we check for the dyn trait, that seems more proper.
@bors r+ |
…ind_map, r=Veykril fix: replace_filter_map_next_with_find_map shouldn't work for dyn trait close #16596
@bors r+ |
☀️ Test successful - checks-actions |
close #16596