Add test for coroutine attribute · rust-lang/rust@d210561 (original) (raw)

2 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
1 +//! The `coroutine` attribute is only allowed on closures.
2 +
3 +#![feature(coroutines)]
4 +
5 +#[coroutine]
6 +//~^ ERROR: attribute should be applied to closures
7 +struct Foo;
8 +
9 +#[coroutine]
10 +//~^ ERROR: attribute should be applied to closures
11 +fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
1 +error: attribute should be applied to closures
2 + --> $DIR/invalid_attr_usage.rs:5:1
3 + |
4 +LL | #[coroutine]
5 + | ^^^^^^^^^^^^
6 +
7 +error: attribute should be applied to closures
8 + --> $DIR/invalid_attr_usage.rs:9:1
9 + |
10 +LL | #[coroutine]
11 + | ^^^^^^^^^^^^
12 +
13 +error: aborting due to 2 previous errors
14 +