diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-08-01 10:03:10 +0000 |
|---|---|---|
| committer | 许杰友 Jieyou Xu (Joe) <jieyouxu@outlook.com> | 2024-08-03 02:28:59 +0000 |
| commit | 33cb33441de5086e5daa2d951619c279fc394681 (patch) | |
| tree | 5f6796532c23b712324921dd6b54f2ffc274306c | |
| parent | ed010dd32c55c2add60dc4baff837b281cf81be8 (diff) | |
| download | rust-33cb33441de5086e5daa2d951619c279fc394681.tar.gz rust-33cb33441de5086e5daa2d951619c279fc394681.zip | |
Add test for `coroutine` attribute
| -rw-r--r-- | tests/ui/coroutine/invalid_attr_usage.rs | 11 | ||||
| -rw-r--r-- | tests/ui/coroutine/invalid_attr_usage.stderr | 14 |
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/ui/coroutine/invalid_attr_usage.rs b/tests/ui/coroutine/invalid_attr_usage.rs new file mode 100644 index 00000000000..995a3aa3100 --- /dev/null +++ b/tests/ui/coroutine/invalid_attr_usage.rs @@ -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() {} diff --git a/tests/ui/coroutine/invalid_attr_usage.stderr b/tests/ui/coroutine/invalid_attr_usage.stderr new file mode 100644 index 00000000000..316a0117e5d --- /dev/null +++ b/tests/ui/coroutine/invalid_attr_usage.stderr @@ -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 + |
