2019-02-23 18:39:27 +00:00
|
|
|
// edition:2015
|
2023-03-16 16:29:01 -03:00
|
|
|
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
|
|
|
|
// revisions: current next
|
2019-02-23 18:39:27 +00:00
|
|
|
|
2020-11-30 22:11:29 +01:00
|
|
|
async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015
|
2019-02-23 18:39:27 +00:00
|
|
|
|
2020-11-30 22:11:29 +01:00
|
|
|
fn baz() { async fn foo() {} } //~ ERROR `async fn` is not permitted in Rust 2015
|
2019-02-23 18:39:27 +00:00
|
|
|
|
2020-11-30 22:11:29 +01:00
|
|
|
async fn async_baz() { //~ ERROR `async fn` is not permitted in Rust 2015
|
|
|
|
async fn bar() {} //~ ERROR `async fn` is not permitted in Rust 2015
|
2019-02-23 18:39:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
struct Foo {}
|
|
|
|
|
|
|
|
impl Foo {
|
2020-11-30 22:11:29 +01:00
|
|
|
async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015
|
2019-02-23 18:39:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
trait Bar {
|
2020-11-30 22:11:29 +01:00
|
|
|
async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015
|
2022-09-02 17:54:58 +00:00
|
|
|
//~^ ERROR functions in traits cannot be declared `async`
|
2019-02-23 18:39:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
macro_rules! accept_item { ($x:item) => {} }
|
|
|
|
|
|
|
|
accept_item! {
|
2020-11-30 22:11:29 +01:00
|
|
|
async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015
|
2019-02-23 18:39:27 +00:00
|
|
|
}
|
|
|
|
|
2019-06-29 21:38:26 +02:00
|
|
|
accept_item! {
|
|
|
|
impl Foo {
|
2020-11-30 22:11:29 +01:00
|
|
|
async fn bar() {} //~ ERROR `async fn` is not permitted in Rust 2015
|
2019-06-29 21:38:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-23 18:39:27 +00:00
|
|
|
let inside_closure = || {
|
2020-11-30 22:11:29 +01:00
|
|
|
async fn bar() {} //~ ERROR `async fn` is not permitted in Rust 2015
|
2019-02-23 18:39:27 +00:00
|
|
|
};
|
|
|
|
}
|