Add attr-on-params test

This commit is contained in:
Ryan Levick 2021-02-09 22:17:10 +01:00
parent 396022b90b
commit 9f0e1d4921
2 changed files with 25 additions and 0 deletions

View file

@ -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() {}

View file

@ -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`.