Files
rust/tests/codegen/issue-98678-closure-generator.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
649 B
Rust
Raw Normal View History

// 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)]
// CHECK: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*}}/codegen/issue-98678-closure-generator.rs{{".*}})
pub fn foo() {
// CHECK: !DICompositeType({{.*"[{]}}closure_env#0{{[}]".*}}file: ![[#FILE]]{{.*}}line: [[# @LINE + 1]],
let closure = |x| x;
closure(0);
// CHECK: !DICompositeType({{.*"[{]}}generator_env#1{{[}]".*}}file: ![[#FILE]]{{.*}}line: [[# @LINE + 1]],
let generator = #[coroutine]
|| yield 1;
}