Add test for coroutine attribute

This commit is contained in:
Oli Scherer 2024-08-01 10:03:10 +00:00 committed by 许杰友 Jieyou Xu (Joe)
parent ed010dd32c
commit 33cb33441d
2 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,11 @@
//! The `coroutine` attribute is only allowed on closures.
#![feature(coroutines)]
#[coroutine]
//~^ ERROR: attribute should be applied to closures
struct Foo;
#[coroutine]
//~^ ERROR: attribute should be applied to closures
fn main() {}

View File

@ -0,0 +1,14 @@
error: attribute should be applied to closures
--> $DIR/invalid_attr_usage.rs:5:1
|
LL | #[coroutine]
| ^^^^^^^^^^^^
error: attribute should be applied to closures
--> $DIR/invalid_attr_usage.rs:9:1
|
LL | #[coroutine]
| ^^^^^^^^^^^^
error: aborting due to 2 previous errors