Skip to content

Commit

Permalink
Add test for coroutine attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk authored and jieyouxu committed Aug 3, 2024
1 parent ed010dd commit 33cb334
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/ui/coroutine/invalid_attr_usage.rs
Original file line number Diff line number Diff line change
@@ -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() {}
14 changes: 14 additions & 0 deletions tests/ui/coroutine/invalid_attr_usage.stderr
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 33cb334

Please sign in to comment.