Closed
Description
I tried this code:
#![allow(incomplete_features)]
#![feature(async_fn_in_trait)]
trait Trait {
async fn foo();
}
struct S;
impl Trait for S {
}
When compiled will provide a (tool-only) suggestion that is not valid:
rustc --edition 2021 --error-format=json foo.rs 2>&1 | jq '.children[0].spans[0].suggested_replacement'
shows the suggestion is:
fn foo() -> impl Future<Output = ()> { todo!() }
I would expect the signature to more closely match the original trait:
async fn foo() { todo!() }
Note: The console output is:
error[E0046]: not all trait items implemented, missing: `foo`
--> foo.rs:10:1
|
5 | async fn foo();
| --------------- `foo` from trait
...
10 | impl Trait for S {
| ^^^^^^^^^^^^^^^^ missing `foo` in implementation
Meta
rustc --version --verbose
:
rustc 1.69.0-nightly (9a7cc6c32 2023-02-16)
binary: rustc
commit-hash: 9a7cc6c32f1a690f86827e4724bcda85e506ef35
commit-date: 2023-02-16
host: aarch64-apple-darwin
release: 1.69.0-nightly
LLVM version: 15.0.7
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: Suggestions generated by the compiler applied by `cargo fix`Category: This is a bug.Diagnostics: A structured suggestion resulting in incorrect code.Static async fn in traitsRelevant to the compiler team, which will review and decide on the PR/issue.
Type
Projects
Status
Done