manual_async_fn suggestions breaks code if !Send types involved #12664
Labels
C-bug
Category: Clippy is not doing the correct thing
I-suggestion-causes-error
Issue: The suggestions provided by this Lint cause an ICE/error when applied
Summary
In suggesting a
fn …(…) -> impl Future<Output=T> + Send
→async fn …(…) -> T
transformation,clippy
can break code where!Send
types are involved.Reproducer
I tried this code:
(Playground)
On this, Clippy emits:
Which seems reasonable ish (although the second
help
feels like it ought to have anasync fn
signature, given the transformation to the body requires it…). If we trade the commented section (what I believe Clippy's suggestion to be), however, that breaks things:(In this minimal example, I've made the
MyRequest
type!Send
by involving aRc
. The real-world use case that got tripped up here involved anactix_web::HttpRequest
, which is also!Send
, again by way of holding onto anRc
.)Version
On the playground:
Rust 1.77.2 (stable)
Clippy 0.1.77
Locally:
Additional Labels
@rustbot label +I-suggestion-causes-error
The text was updated successfully, but these errors were encountered: