Closed
Description
Summary
.
Lint Name
manual_async_fn
Reproducer
I tried this code:
use std::future::Future;
pub fn get_int_future() -> impl Future<Output = i32> {
async { 42 }
}
pub fn main() {}
I saw this happen:
help: make the function `async` and return the output of the future directly
|
5 | async pub fn get_int_future() -> i32 {
I expected to see this happen:
this does not compile, we need pub async
instead of async pub
here
error: expected one of `extern`, `fn`, or `unsafe`, found keyword `pub`
--> src/main.rs:5:7
|
5 | async pub fn get_int_future() -> i32 { 42 }
| ------^^^
| | |
| | expected one of `extern`, `fn`, or `unsafe`
| help: visibility `pub` must come before `async`: `pub async`
error: aborting due to previous error
Version
rustc 1.69.0-nightly (44cfafe2f 2023-03-03)
binary: rustc
commit-hash: 44cfafe2fafe816395d3acc434663a45d5178c41
commit-date: 2023-03-03
host: x86_64-unknown-linux-gnu
release: 1.69.0-nightly
LLVM version: 15.0.7
Additional Labels
No response