Skip to content

Commit 9f0e1d4

Browse files
committed
Add attr-on-params test
1 parent 396022b commit 9f0e1d4

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// This checks that incorrect params on function parameters are caught
2+
3+
fn function(#[inline] param: u32) {
4+
//~^ ERROR attribute should be applied to function or closure
5+
//~| ERROR allow, cfg, cfg_attr, deny, forbid, and warn are the only allowed built-in attributes
6+
}
7+
8+
fn main() {}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
error: allow, cfg, cfg_attr, deny, forbid, and warn are the only allowed built-in attributes in function parameters
2+
--> $DIR/attrs-on-params.rs:3:13
3+
|
4+
LL | fn function(#[inline] param: u32) {
5+
| ^^^^^^^^^
6+
7+
error[E0518]: attribute should be applied to function or closure
8+
--> $DIR/attrs-on-params.rs:3:13
9+
|
10+
LL | fn function(#[inline] param: u32) {
11+
| ^^^^^^^^^-----------
12+
| |
13+
| not a function or closure
14+
15+
error: aborting due to 2 previous errors
16+
17+
For more information about this error, try `rustc --explain E0518`.

0 commit comments

Comments
 (0)