Skip to content

Commit

Permalink
Add attr-on-params test
Browse files Browse the repository at this point in the history
  • Loading branch information
rylev committed Feb 9, 2021
1 parent 396022b commit 9f0e1d4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/test/ui/attributes/attrs-on-params.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// This checks that incorrect params on function parameters are caught

fn function(#[inline] param: u32) {
//~^ ERROR attribute should be applied to function or closure
//~| ERROR allow, cfg, cfg_attr, deny, forbid, and warn are the only allowed built-in attributes
}

fn main() {}
17 changes: 17 additions & 0 deletions src/test/ui/attributes/attrs-on-params.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
error: allow, cfg, cfg_attr, deny, forbid, and warn are the only allowed built-in attributes in function parameters
--> $DIR/attrs-on-params.rs:3:13
|
LL | fn function(#[inline] param: u32) {
| ^^^^^^^^^

error[E0518]: attribute should be applied to function or closure
--> $DIR/attrs-on-params.rs:3:13
|
LL | fn function(#[inline] param: u32) {
| ^^^^^^^^^-----------
| |
| not a function or closure

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0518`.

0 comments on commit 9f0e1d4

Please sign in to comment.