-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Nested closures give suboptimal move suggestion #64008
Comments
Note that both |
Oh... hmm... I thought I had a situation where only the inner one is needed. I'll investigate more. |
Triage: little change. Current output:
and when applying the suggestion we fail to suggest the second necessary move:
|
Suggest `move` in nested closure when appropriate Fix rust-lang#64008.
Suggest `move` in nested closure when appropriate Fix rust-lang#64008.
@estebank , the compiler still gives bad advice. Please, reopen the bug. Consider this code: fn main() {
let get = |path: &str| || {
assert!(path.starts_with('/'));
};
} Playground: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=7d311a40c9b0662af5b2894f7ce8e6eb
The compiler suggests adding |
I'm not entirely sure what we should suggest in that case, if anything. |
The following code needs a
move
on themap
closure, but the suggestion first tells us to add it to theflat_map
closure. After following that suggestion, the next error will tell us to put it on themap
closure. This terminates correctly, but should suggest the final thing immediately. Note that with many nested levels of closures, there will be one error-fix-recompile cycle per nested closure until we get it working.(Playground)
Errors:
The text was updated successfully, but these errors were encountered: