-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Uncertain maybe-incorrect suggestion for impl_trait_overcaptures #132932
Comments
I can't remember why I marked it as maybe-incorrect, though in this case we probably will have a problem since it'll suggest I don't have the time to majorly overhaul how we issue this suggestion to turn that into a I think we can probably make it machine applicable except for when there's a |
Another place where it cannot be machine applicable is when there are APITs, since turning a |
The suggestions it gives in every case is Regarding the case with the ambiguous lifetime, I don't think I have seen that in the crater run, yet. And I'm now seeing that #132816 changed it so that all impl_trait_overcaptures suggestions are maybe-incorrect. Am I interpreting that correctly? The PR doesn't mention that change. That could be a significant hurdle for some projects since some will have dozens of RPITs to update. If we are going with all maybe-incorrect, we'll at least need to update the documentation in https://doc.rust-lang.org/nightly/edition-guide/rust-2024/rpit-lifetime-capture.html#migrating-while-avoiding-overcapturing that you'll need to make all changes manually. |
Yes, and that was an oversight. Sorry, I'm not perfect :) |
Also, I misspoke. There should never be a case where we capture an elided lifetime that would be incorrect to name in the |
#132938 addresses this |
…r=chenyukang Make precise capturing suggestion machine-applicable only if it has no APITs cc rust-lang#132932 The only case where this suggestion is not machine-applicable is when we suggest turning arg-position impl trait into type parameters, which may expose type parameters that were not turbofishable before.
Rollup merge of rust-lang#132938 - compiler-errors:ed2024-apit-sugg, r=chenyukang Make precise capturing suggestion machine-applicable only if it has no APITs cc rust-lang#132932 The only case where this suggestion is not machine-applicable is when we suggest turning arg-position impl trait into type parameters, which may expose type parameters that were not turbofishable before.
Closing as I believe this is now resolved. Thanks! |
This is mostly a question for @compiler-errors (and really just an edition-guide issue). This is regarding the maybe-incorrect suggestion for
impl_trait_overcaptures
in the following specific scenario:https://crater-reports.s3.amazonaws.com/pr-132712/try%23da25749bf5e6ba5ed862ff361c19afff2a986b2d/reg/srdf-0.1.52/log.txt
where the general code looks like:
This generates the
impl_trait_overcaptures
with maybe-incorrect applicability.The question I have is that I do not see this scenario described in https://doc.rust-lang.org/nightly/edition-guide/rust-2024/rpit-lifetime-capture.html, and thus left being uncertain about why it thinks it is maybe incorrect. I assume it is something to do with the associated types, but it wasn't immediately obvious how to minimize this scenario.
If this isn't already documented on https://doc.rust-lang.org/nightly/edition-guide/rust-2024/rpit-lifetime-capture.html about why it might be wrong to blindly follow the compiler, would it be possible to describe the scenario and what considerations the author should take before accepting the suggestion?
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: