]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/async-fn-debug-msvc.rs
Rollup merge of #82535 - wesleywiser:wip_codegen_thread_names, r=nagisa
[rust.git] / src / test / codegen / async-fn-debug-msvc.rs
1 // Verify debuginfo for generators:
2 //  - Each variant points to the file and line of its yield point
3 //  - The generator types and variants are marked artificial
4 //  - Captured vars from the source are not marked artificial
5 //
6 // ignore-tidy-linelength
7 // compile-flags: -C debuginfo=2 --edition=2018
8 // only-msvc
9
10 async fn foo() {}
11 async fn async_fn_test() {
12     foo().await;
13     let s = String::from("foo");
14     foo().await;
15 }
16
17 // FIXME: No way to reliably check the filename.
18
19 // CHECK-DAG:  [[ASYNC_FN:!.*]] = !DINamespace(name: "async_fn_test"
20 // CHECK-DAG:  [[GEN:!.*]] = !DICompositeType(tag: DW_TAG_union_type, name: "generator-0", scope: [[ASYNC_FN]], {{.*}}flags: DIFlagArtificial
21 // CHECK:      {{!.*}} = !DIDerivedType(tag: DW_TAG_member, scope: [[GEN]],
22 // For brevity, we only check the struct name and members of the last variant.
23 // CHECK-SAME: file: [[FILE:![0-9]*]], line: 11,
24 // CHECK-SAME: flags: DIFlagArtificial
25 // CHECK:      {{!.*}} = !DIDerivedType(tag: DW_TAG_member, scope: [[GEN]],
26 // CHECK-SAME: file: [[FILE]], line: 15,
27 // CHECK-SAME: flags: DIFlagArtificial
28 // CHECK:      {{!.*}} = !DIDerivedType(tag: DW_TAG_member, scope: [[GEN]],
29 // CHECK-SAME: file: [[FILE]], line: 15,
30 // CHECK-SAME: flags: DIFlagArtificial
31 // CHECK:      {{!.*}} = !DIDerivedType(tag: DW_TAG_member, scope: [[GEN]],
32 // CHECK-SAME: file: [[FILE]], line: 12,
33 // CHECK-SAME: flags: DIFlagArtificial
34 // CHECK:      {{!.*}} = !DIDerivedType(tag: DW_TAG_member, scope: [[GEN]],
35 // CHECK-SAME: file: [[FILE]], line: 14,
36 // CHECK-SAME: baseType: [[VARIANT:![0-9]*]]
37 // CHECK-SAME: flags: DIFlagArtificial
38 // CHECK:      [[S1:!.*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "Suspend1", scope: [[ASYNC_FN]],
39 // CHECK-SAME: flags: DIFlagArtificial
40 // CHECK:      {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "RUST$ENUM$DISR", scope: [[S1]],
41 // CHECK-SAME: flags: DIFlagArtificial
42 // CHECK:      {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "s", scope: [[S1]]
43 // CHECK-NOT:  flags: DIFlagArtificial
44 // CHECK-SAME: )
45
46 fn main() {
47     let _dummy = async_fn_test();
48 }