2023-01-21 13:57:16 -05:00
|
|
|
// This test verifies the accuracy of emitted file and line debuginfo metadata for closures and
|
2024-03-01 23:56:03 -05:00
|
|
|
// coroutines.
|
2023-01-21 13:57:16 -05:00
|
|
|
//
|
2024-03-02 02:05:29 -05:00
|
|
|
//@ compile-flags: --crate-type=lib -Copt-level=0 -Cdebuginfo=2 -Zdebug-info-type-line-numbers=true
|
2024-03-01 23:56:03 -05:00
|
|
|
#![feature(coroutines, stmt_expr_attributes)]
|
2023-01-21 13:57:16 -05:00
|
|
|
|
2023-01-21 14:02:34 -05:00
|
|
|
// ignore-tidy-linelength
|
|
|
|
|
|
2024-03-14 13:43:25 -05:00
|
|
|
// NONMSVC-DAG: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*}}/issue-98678-closure-coroutine.rs{{".*}})
|
|
|
|
|
// MSVC-DAG: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*}}\\issue-98678-closure-coroutine.rs{{".*}})
|
2023-01-21 13:57:16 -05:00
|
|
|
|
|
|
|
|
pub fn foo() {
|
2024-03-02 02:05:29 -05:00
|
|
|
// NONMSVC-DAG: !DICompositeType({{.*"}}{closure_env#0}{{".*}}file: ![[#FILE]]{{.*}}line: [[# @LINE + 2]],
|
2023-01-21 14:00:35 -05:00
|
|
|
// 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);
|
|
|
|
|
|
2024-03-14 13:43:25 -05:00
|
|
|
// NONMSVC-DAG: !DICompositeType({{.*"[{]}}coroutine_env#1{{[}]".*}}file: ![[#FILE]]{{.*}}line: [[# @LINE + 2]],
|
|
|
|
|
// MSVC-DAG: !DICompositeType({{.*".*foo::}}coroutine_env$1>{{".*}}file: ![[#FILE]]{{.*}}line: [[# @LINE + 1]],
|
2024-03-02 02:05:29 -05:00
|
|
|
let _coroutine = #[coroutine]
|
2023-01-21 13:57:16 -05:00
|
|
|
|| yield 1;
|
|
|
|
|
}
|