2024-12-18 12:24:30 +00:00
|
|
|
// ignore-tidy-linelength
|
|
|
|
//! This test verifies the accuracy of emitted file and line debuginfo metadata for async blocks and
|
|
|
|
//! async functions.
|
|
|
|
|
|
|
|
//@ revisions: MSVC NONMSVC
|
|
|
|
//@[MSVC] only-msvc
|
|
|
|
//@[NONMSVC] ignore-msvc
|
2024-03-02 05:36:35 +00:00
|
|
|
//@ edition:2021
|
2024-03-02 07:05:29 +00:00
|
|
|
//@ compile-flags: --crate-type=lib -Copt-level=0 -Cdebuginfo=2 -Zdebug-info-type-line-numbers=true
|
2023-01-21 21:04:42 +00:00
|
|
|
|
2024-12-03 02:59:34 +00:00
|
|
|
// NONMSVC-DAG: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*[/\\]}}issue-98678-async.rs{{".*}})
|
2023-07-30 03:48:54 +00:00
|
|
|
// MSVC: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*}}\\issue-98678-async.rs{{".*}})
|
2023-01-21 21:04:42 +00:00
|
|
|
|
|
|
|
// NONMSVC-DAG: !DISubprogram(name: "foo",{{.*}}file: ![[#FILE]]{{.*}}line: [[# @LINE + 2]],
|
|
|
|
// MSVC-DAG: !DISubprogram(name: "foo",{{.*}}file: ![[#FILE]]{{.*}}line: [[# @LINE + 1]],
|
2023-07-30 03:48:54 +00:00
|
|
|
pub async fn foo() -> u8 {
|
|
|
|
5
|
|
|
|
}
|
2023-01-21 21:04:42 +00:00
|
|
|
|
|
|
|
pub fn bar() -> impl std::future::Future<Output = u8> {
|
|
|
|
// NONMSVC: !DICompositeType({{.*"}}{async_block_env#0}{{".*}}file: ![[#FILE]]{{.*}}line: [[# @LINE + 2]],
|
|
|
|
// MSVC-DAG: !DICompositeType({{.*"}}enum2$<issue_98678_async::bar::async_block_env$0>{{".*}}file: ![[#FILE]]{{.*}}line: [[# @LINE + 1]],
|
|
|
|
async {
|
|
|
|
let x: u8 = foo().await;
|
|
|
|
x + 5
|
|
|
|
}
|
|
|
|
}
|