diff options
| author | Matt Weber <30441572+mweber15@users.noreply.github.com> | 2023-01-21 16:04:42 -0500 |
|---|---|---|
| committer | Matt Weber <30441572+mweber15@users.noreply.github.com> | 2024-11-06 22:26:17 -0500 |
| commit | aa1a16a359345502bc4bf2186accf6871dc06b2d (patch) | |
| tree | 6a2d2e70529e4968c93f75fd9e7d496efcfc49c9 /tests/codegen | |
| parent | f92fc886f447c29242e0fa7856dbfc810801ed62 (diff) | |
| download | rust-aa1a16a359345502bc4bf2186accf6871dc06b2d.tar.gz rust-aa1a16a359345502bc4bf2186accf6871dc06b2d.zip | |
Add test for async function and async block
Diffstat (limited to 'tests/codegen')
| -rw-r--r-- | tests/codegen/issue-98678-async.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/codegen/issue-98678-async.rs b/tests/codegen/issue-98678-async.rs new file mode 100644 index 00000000000..e937cfaddc6 --- /dev/null +++ b/tests/codegen/issue-98678-async.rs @@ -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 + } + +} |
