-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
2024 impl_trait_overcaptures false negative, plus bad suggestion in 2024 #132809
Copy link
Copy link
Closed
Labels
A-edition-2024Area: The 2024 editionArea: The 2024 editionA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.D-editionDiagnostics: An error or lint that should account for edition differences.Diagnostics: An error or lint that should account for edition differences.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.L-false-negativeLint: False negative (should have fired but didn't).Lint: False negative (should have fired but didn't).L-impl_trait_overcapturesLint: impl_trait_overcapturesLint: impl_trait_overcapturesT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Metadata
Metadata
Assignees
Labels
A-edition-2024Area: The 2024 editionArea: The 2024 editionA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.D-editionDiagnostics: An error or lint that should account for edition differences.Diagnostics: An error or lint that should account for edition differences.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.L-false-negativeLint: False negative (should have fired but didn't).Lint: False negative (should have fired but didn't).L-impl_trait_overcapturesLint: impl_trait_overcapturesLint: impl_trait_overcapturesT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
No fields configured for issues without a type.
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_overcapturesto 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: