]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/async-fn-debug-msvc.rs
Rollup merge of #90277 - pierwill:fix-70258-inference-terms, r=jackh726
[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 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:  [[ASYNC_FN:!.*]] = !DINamespace(name: "async_fn_test"
20 // CHECK-DAG:  [[GEN:!.*]] = !DICompositeType(tag: DW_TAG_union_type, name: "async_fn$0"
21 // CHECK:      {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant0", 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-NOT:  flags: DIFlagArtificial
25 // CHECK-SAME: )
26 // CHECK:      {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant1", scope: [[GEN]],
27 // CHECK-SAME: file: [[FILE]], line: 15,
28 // CHECK-NOT:  flags: DIFlagArtificial
29 // CHECK-SAME: )
30 // CHECK:      {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant2", scope: [[GEN]],
31 // CHECK-SAME: file: [[FILE]], line: 15,
32 // CHECK-NOT:  flags: DIFlagArtificial
33 // CHECK-SAME: )
34 // CHECK:      {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant3", scope: [[GEN]],
35 // CHECK-SAME: file: [[FILE]], line: 12,
36 // CHECK-NOT:  flags: DIFlagArtificial
37 // CHECK-SAME: )
38 // CHECK:      {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant4", scope: [[GEN]],
39 // CHECK-SAME: file: [[FILE]], line: 14,
40 // CHECK-SAME: baseType: [[VARIANT:![0-9]*]]
41 // CHECK-NOT:  flags: DIFlagArtificial
42 // CHECK-SAME: )
43 // CHECK:      [[S1:!.*]] = !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: [[S1]]
47 // CHECK-NOT:  flags: DIFlagArtificial
48 // CHECK-SAME: )
49 // CHECK:      {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "discriminant", scope: [[GEN]],
50 // CHECK-NOT: flags: DIFlagArtificial
51
52 fn main() {
53     let _dummy = async_fn_test();
54 }