-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTA-specializationArea: Trait impl specializationArea: Trait impl specializationC-bugCategory: This is a bug.Category: This is a bug.F-specialization`#![feature(specialization)]``#![feature(specialization)]`T-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.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Description
The async
keyword doesn't seem to currently work with specialization (namely default fn
). The order of keywords does not matter — I'm not sure which it's supposed to be.
Minimal example from @dtolnay in dtolnay/async-trait#25:
macro_rules! item {
($i:item) => {}
}
item! {
trait Trait {
async default fn f() {}
}
}
item! {
trait Trait {
default async fn f() {}
}
}
which gives the following error
error: expected one of `extern`, `fn`, or `unsafe`, found `default`
--> src/main.rs:7:15
|
7 | async default fn f() {}
| ^^^^^^^ expected one of `extern`, `fn`, or `unsafe` here
error: missing `fn`, `type`, or `const` for trait-item declaration
--> src/main.rs:12:18
|
12 | trait Trait {
| __________________^
13 | | default async fn f() {}
| |________^ missing `fn`, `type`, or `const`
error: aborting due to 2 previous errors
Metadata
Metadata
Assignees
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTA-specializationArea: Trait impl specializationArea: Trait impl specializationC-bugCategory: This is a bug.Category: This is a bug.F-specialization`#![feature(specialization)]``#![feature(specialization)]`T-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.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.