Add attr-on-params test
This commit is contained in:
parent
396022b90b
commit
9f0e1d4921
2 changed files with 25 additions and 0 deletions
8
src/test/ui/attributes/attrs-on-params.rs
Normal file
8
src/test/ui/attributes/attrs-on-params.rs
Normal 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() {}
|
17
src/test/ui/attributes/attrs-on-params.stderr
Normal file
17
src/test/ui/attributes/attrs-on-params.stderr
Normal 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`.
|
Loading…
Reference in a new issue