Closed
Description
Code
I tried this code:
#[track_caller]
async fn foo() {
println!("{}", std::panic::Location::caller());
}
#[tokio::main]
async fn main() {
foo().await;
}
I expected to see this happen: a successful build that prints src/main.rs:3:20
(i.e. the attribute is a no-op)
Instead, this happened:
Compiling playground v0.0.1 (/playground)
error[[E0658]](https://doc.rust-lang.org/nightly/error-index.html#E0658): `#[track_caller]` on closures is currently unstable
--> src/main.rs:2:16
|
2 | async fn foo() {}
| ^^
|
= note: [see issue #87417 <https://github.com/rust-lang/rust/issues/87417>](https://github.com/rust-lang/rust/issues/87417) for more information
= help: [add `#![feature(closure_track_caller)]`](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#) to the crate attributes to enable
Version it worked on
It most recently worked on: 1.65.0 stable
Version with regression
playground's current nightly: 1.67.0-nightly (2022-11-17 83356b78c4ff3e7d84e9)
I think this compilation failure was introduced by #104219 which adds actual support for track_caller on async fn's, since it was previously a no-op.
TBH, in hindsight I think we probably should have disallowed track_caller on async fn's in the initial implementation so that we could leave room for unstable support in the future. However given that this wasn't considered, it seems like this may now be a stability regression.