Skip to content

async{} blocks can no longer be used in functions marked as #[track_caller] #105134

Closed
@WaffleLapkin

Description

@WaffleLapkin

Code

The following code compiles and works as expected on nightly-2022-11-17 and fails on nightly-2022-11-18:

#[track_caller]
pub fn f() {
    _ = async {};
}
error[E0658]: `#[track_caller]` on closures is currently unstable
 --> src/lib.rs:3:9
  |
3 |     _ = async {};
  |         ^^^^^^^^
  |
  = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
  = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable

(play)

Version it worked on

It most recently worked on: nightly-2022-11-17

Version with regression

rustc --version --verbose:

rustc 1.67.0-nightly (c97b539e4 2022-11-30)
binary: rustc
commit-hash: c97b539e408ea353f4fde2f9251d598291fec421
commit-date: 2022-11-30
host: x86_64-unknown-linux-gnu
release: 1.67.0-nightly
LLVM version: 15.0.4

Similarly to #104588, this is caused by #104219, but this reproduction doesn't even use #[track_caller] on async fn!
btw I've found this b/c users of my crate reported that it doesn't compile anymore, good stuff


@rustbot modify labels: +regression-from-stable-to-nightly -regression-untriaged
cc @bryangarza

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions