Add test for async function and async block
This commit is contained in:
parent
f92fc886f4
commit
aa1a16a359
1 changed files with 25 additions and 0 deletions
25
tests/codegen/issue-98678-async.rs
Normal file
25
tests/codegen/issue-98678-async.rs
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
// This test verifies the accuracy of emitted file and line debuginfo metadata for async blocks and
|
||||||
|
// async functions.
|
||||||
|
//
|
||||||
|
// edition: 2021
|
||||||
|
// compile-flags: -C debuginfo=2
|
||||||
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
|
// ignore-tidy-linelength
|
||||||
|
|
||||||
|
// NONMSVC-DAG: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*}}/codegen/issue-98678-async.rs{{".*}})
|
||||||
|
// MSVC: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*}}\\codegen\\issue-98678-async.rs{{".*}})
|
||||||
|
|
||||||
|
// NONMSVC-DAG: !DISubprogram(name: "foo",{{.*}}file: ![[#FILE]]{{.*}}line: [[# @LINE + 2]],
|
||||||
|
// MSVC-DAG: !DISubprogram(name: "foo",{{.*}}file: ![[#FILE]]{{.*}}line: [[# @LINE + 1]],
|
||||||
|
pub async fn foo() -> u8 { 5 }
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue