rust/tests/ui/async-await/track-caller/async-closure-gate.rs
Bryan Garza 673ab17c7f Add separate feature gate for async fn track caller
This patch adds a feature gate `async_fn_track_caller` that is separate from `closure_track_caller`. This is to allow enabling `async_fn_track_caller` separately.

Fixes #110009
2023-08-02 14:18:21 -07:00

51 lines
1.1 KiB
Rust

// edition:2021
// revisions: afn nofeat
#![feature(async_closure, stmt_expr_attributes)]
#![cfg_attr(afn, feature(async_fn_track_caller))]
fn main() {
let _ = #[track_caller] async || {
//~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
};
}
#[track_caller]
async fn foo() {
let _ = #[track_caller] async || {
//~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
};
}
async fn foo2() {
let _ = #[track_caller] || {
//~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
};
}
fn foo3() {
async {
let _ = #[track_caller] || {
//~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
};
}
}
async fn foo4() {
let _ = || {
#[track_caller] || {
//~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
};
};
}
fn foo5() {
async {
let _ = || {
#[track_caller] || {
//~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
};
};
}
}