24116aebe0
Fix AFIT lint message to mention pitfall Addresses https://github.com/rust-lang/rust/pull/116184#issuecomment-1745194387 by adding a short note. Not sure exactly of the wording -- I don't think this should be a blocker for the stabilization PR since we can iterate on this lint's messaging in the next few weeks in the worst case. r? `@tmandry` cc `@traviscross` `@jonhoo`
21 lines
789 B
Plaintext
21 lines
789 B
Plaintext
error: use of `async fn` in public traits is discouraged as auto trait bounds cannot be specified
|
|
--> $DIR/warn.rs:6:5
|
|
|
|
|
LL | async fn not_send();
|
|
| ^^^^^
|
|
|
|
|
= note: you can suppress this lint if you plan to use the trait only in your own code, or do not care about auto traits like `Send` on the `Future`
|
|
note: the lint level is defined here
|
|
--> $DIR/warn.rs:3:9
|
|
|
|
|
LL | #![deny(async_fn_in_trait)]
|
|
| ^^^^^^^^^^^^^^^^^
|
|
help: you can alternatively desugar to a normal `fn` that returns `impl Future` and add any desired bounds such as `Send`, but these cannot be relaxed without a breaking API change
|
|
|
|
|
LL - async fn not_send();
|
|
LL + fn not_send() -> impl std::future::Future<Output = ()> + Send;
|
|
|
|
|
|
|
error: aborting due to previous error
|
|
|