-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
2024 impl_trait_overcaptures false negative, plus bad suggestion in 2024 #132809
Comments
It would be very cool if someone worked on this. I probably do not have the patience to do this for the time being since it's incredibly tediuous and annoying and error-prone to provide a general suggestion that handles APITs correctly, but I'd love to mentor or review a change to robustify this diagnostic, and also the edition lint ( |
@ehuss: The 2024 migration for actix-web-lab@0.23.0 failed to detect a situation where an impl trait needs some kind of capture. Seems like we're not recursing into async fn. I'll fix that. |
Actually wait, I think I did implement something to turn APITs into params. I'll try to adapt that....... |
Dont suggest `use<impl Trait>` when we have an edition-2024-related borrowck issue rust-lang#131186 implements some machinery to detect in borrowck when we may have RPIT overcaptures due to edition 2024, and suggests adding `+ use<'a, T>` to go back to the edition 2021 capture rules. However, we weren't filtering out cases when there are APITs in scope. This PR implements a more sophisticated diagnostic where we will suggest turning any APITs in scope into type parameters, and applies this to both the borrowck error note, and to the `impl_trait_overcaptures` migration lint. cc rust-lang#132809
Rollup merge of rust-lang#132816 - compiler-errors:2024-apit, r=jieyouxu Dont suggest `use<impl Trait>` when we have an edition-2024-related borrowck issue rust-lang#131186 implements some machinery to detect in borrowck when we may have RPIT overcaptures due to edition 2024, and suggests adding `+ use<'a, T>` to go back to the edition 2021 capture rules. However, we weren't filtering out cases when there are APITs in scope. This PR implements a more sophisticated diagnostic where we will suggest turning any APITs in scope into type parameters, and applies this to both the borrowck error note, and to the `impl_trait_overcaptures` migration lint. cc rust-lang#132809
Dont suggest `use<impl Trait>` when we have an edition-2024-related borrowck issue rust-lang#131186 implements some machinery to detect in borrowck when we may have RPIT overcaptures due to edition 2024, and suggests adding `+ use<'a, T>` to go back to the edition 2021 capture rules. However, we weren't filtering out cases when there are APITs in scope. This PR implements a more sophisticated diagnostic where we will suggest turning any APITs in scope into type parameters, and applies this to both the borrowck error note, and to the `impl_trait_overcaptures` migration lint. cc rust-lang#132809
…tures-apit, r=BoxyUwU Recurse into APITs in `impl_trait_overcaptures` We were previously not detecting cases where an RPIT was located in the return type of an async function, leading to underfiring of the `impl_trait_overcaptures`. This PR does this recursion properly now. cc rust-lang#132809
Rollup merge of rust-lang#132817 - compiler-errors:impl-trait-overcaptures-apit, r=BoxyUwU Recurse into APITs in `impl_trait_overcaptures` We were previously not detecting cases where an RPIT was located in the return type of an async function, leading to underfiring of the `impl_trait_overcaptures`. This PR does this recursion properly now. cc rust-lang#132809
I'm going to close as fixed:
|
The 2024 migration for actix-web-lab@0.23.0 failed to detect a situation where an impl trait needs some kind of capture. The following error occurs after updating to 2024:
I would expect
impl_trait_overcaptures
to migrate this, or if migration isn't possible to at least generate a warning.Additionally, the suggestion provided in this error message is not valid syntax.
use<>
cannot haveimpl MessageBody
.I believe this is an example of APIT migration. That is, the following change I think is a suggestion it could provide:
Here the impl trait gets lifted to have a named type parameter which can then be used in the
use<>
bound.Or...There might be other suggestions, I don't know. The offending code involves some tricky async-block stuff.
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: