forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#128581 - jieyouxu:checked-attr, r=nnethercote Assert that all attributes are actually checked via `CheckAttrVisitor` and aren't accidentally usable on completely unrelated HIR nodes ``@oli-obk's`` rust-lang#128444 with unreachable case removed to avoid that PR bitrotting away. Based on rust-lang#128402. This PR will make adding a new attribute ICE on any use of that attribute unless it gets a handler added in `rustc_passes::CheckAttrVisitor`. r? ``@nnethercote`` (since you were the reviewer of the original PR)
- Loading branch information
Showing
6 changed files
with
104 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|