]> git.lizzy.rs Git - rust.git/blob - tests/codegen/async-fn-debug-msvc.rs
Rollup merge of #106644 - alexcrichton:update-wasi-toolchain, r=cuviper
[rust.git] / tests / 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 discriminants are marked artificial
4 //  - Other fields are not marked artificial
5 //
6 //
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:  [[GEN:!.*]] = !DICompositeType(tag: DW_TAG_union_type, name: "enum2$<async_fn_debug_msvc::async_fn_test::async_fn_env$0>",
20 // CHECK:      {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant0", scope: [[GEN]],
21 // For brevity, we only check the struct name and members of the last variant.
22 // CHECK-SAME: file: [[FILE:![0-9]*]], line: 11,
23 // CHECK-NOT:  flags: DIFlagArtificial
24 // CHECK-SAME: )
25 // CHECK:      {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant1", scope: [[GEN]],
26 // CHECK-SAME: file: [[FILE]], line: 15,
27 // CHECK-NOT:  flags: DIFlagArtificial
28 // CHECK-SAME: )
29 // CHECK:      {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant2", scope: [[GEN]],
30 // CHECK-SAME: file: [[FILE]], line: 15,
31 // CHECK-NOT:  flags: DIFlagArtificial
32 // CHECK-SAME: )
33 // CHECK:      {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant3", scope: [[GEN]],
34 // CHECK-SAME: file: [[FILE]], line: 12,
35 // CHECK-NOT:  flags: DIFlagArtificial
36 // CHECK-SAME: )
37 // CHECK:      {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant4", scope: [[GEN]],
38 // CHECK-SAME: file: [[FILE]], line: 14,
39 // CHECK-SAME: baseType: [[VARIANT_WRAPPER:![0-9]*]]
40 // CHECK-NOT:  flags: DIFlagArtificial
41 // CHECK-SAME: )
42 // CHECK:      {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "value", scope: [[VARIANT_WRAPPER]], file: !2, baseType: [[VARIANT:![0-9]*]],
43 // CHECK:      [[VARIANT]] = !DICompositeType(tag: DW_TAG_structure_type, name: "Suspend1", scope: [[GEN]],
44 // CHECK-NOT:  flags: DIFlagArtificial
45 // CHECK-SAME: )
46 // CHECK:      {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "s", scope: [[VARIANT]]
47 // CHECK-NOT:  flags: DIFlagArtificial
48 // CHECK-SAME: )
49 // CHECK:      {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "tag", scope: [[GEN]],
50 // CHECK-NOT: flags: DIFlagArtificial
51
52 fn main() {
53     let _dummy = async_fn_test();
54 }