2023-01-21 13:57:16 -05:00
|
|
|
// This test verifies the accuracy of emitted file and line debuginfo metadata for closures and
|
|
|
|
|
// generators.
|
|
|
|
|
//
|
|
|
|
|
// compile-flags: -C debuginfo=2
|
|
|
|
|
#![crate_type = "lib"]
|
|
|
|
|
#![feature(generators, stmt_expr_attributes)]
|
|
|
|
|
|
2023-01-21 14:00:35 -05:00
|
|
|
// NONMSVC: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*}}/codegen/issue-98678-closure-generator.rs{{".*}})
|
|
|
|
|
// MSVC: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*}}\\codegen\\issue-98678-closure-generator.rs{{".*}})
|
2023-01-21 13:57:16 -05:00
|
|
|
|
|
|
|
|
pub fn foo() {
|
2023-01-21 14:00:35 -05:00
|
|
|
// NONMSVC: !DICompositeType({{.*"}}{closure_env#0}{{".*}}file: ![[#FILE]]{{.*}}line: [[# @LINE + 2]],
|
|
|
|
|
// MSVC-DAG: !DICompositeType({{.*"}}closure_env$0{{".*}}file: ![[#FILE]]{{.*}}line: [[# @LINE + 1]],
|
2023-01-21 13:57:16 -05:00
|
|
|
let closure = |x| x;
|
|
|
|
|
closure(0);
|
|
|
|
|
|
2023-01-21 14:00:35 -05:00
|
|
|
// NONMSVC: !DICompositeType({{.*"[{]}}generator_env#1{{[}]".*}}file: ![[#FILE]]{{.*}}line: [[# @LINE + 2]],
|
|
|
|
|
// MSVC-DAG: !DICompositeType({{.*".*foo::}}generator_env$1>{{".*}}file: ![[#FILE]]{{.*}}line: [[# @LINE + 1]],
|
2023-01-21 13:57:16 -05:00
|
|
|
let generator = #[coroutine]
|
|
|
|
|
|| yield 1;
|
|
|
|
|
}
|