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
6 // ignore-tidy-linelength
7 // compile-flags: -C debuginfo=2 --edition=2018
11 async fn async_fn_test() {
13 let s = String::from("foo");
17 // FIXME: No way to reliably check the filename.
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
47 let _dummy = async_fn_test();