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

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

24 lines
1.0 KiB
Rust
Raw Normal View History

// This test verifies the accuracy of emitted file and line debuginfo metadata for closures and
// generators.
//
2024-03-01 23:33:46 -05:00
// compile-flags: -C debuginfo=2 -Z debug-info-type-line-numbers=true
#![crate_type = "lib"]
#![feature(generators, stmt_expr_attributes)]
// ignore-tidy-linelength
// NONMSVC: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*}}/issue-98678-closure-generator.rs{{".*}})
// MSVC: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*}}\\issue-98678-closure-generator.rs{{".*}})
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]],
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]],
let generator = #[coroutine]
|| yield 1;
}