Skip to content

Commit 4552c8f

Browse files
committed
Add test for attribute error checking on trait and foreign items
1 parent af2b497 commit 4552c8f

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#![feature(extern_types)]
2+
3+
trait Trait {
4+
#[inline] //~ ERROR attribute should be applied to function or closure
5+
const X: u32;
6+
7+
#[inline] //~ ERROR attribute should be applied to function or closure
8+
type T;
9+
}
10+
11+
extern {
12+
#[inline] //~ ERROR attribute should be applied to function or closure
13+
static X: u32;
14+
15+
#[inline] //~ ERROR attribute should be applied to function or closure
16+
type T;
17+
}
18+
19+
fn main() {}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
error[E0518]: attribute should be applied to function or closure
2+
--> $DIR/inline-trait-and-foreign-items.rs:12:5
3+
|
4+
LL | #[inline]
5+
| ^^^^^^^^^
6+
LL | static X: u32;
7+
| -------------- not a function or closure
8+
9+
error[E0518]: attribute should be applied to function or closure
10+
--> $DIR/inline-trait-and-foreign-items.rs:15:5
11+
|
12+
LL | #[inline]
13+
| ^^^^^^^^^
14+
LL | type T;
15+
| ------- not a function or closure
16+
17+
error[E0518]: attribute should be applied to function or closure
18+
--> $DIR/inline-trait-and-foreign-items.rs:4:5
19+
|
20+
LL | #[inline]
21+
| ^^^^^^^^^
22+
LL | const X: u32;
23+
| ------------- not a function or closure
24+
25+
error[E0518]: attribute should be applied to function or closure
26+
--> $DIR/inline-trait-and-foreign-items.rs:7:5
27+
|
28+
LL | #[inline]
29+
| ^^^^^^^^^
30+
LL | type T;
31+
| ------- not a function or closure
32+
33+
error: aborting due to 4 previous errors
34+
35+
For more information about this error, try `rustc --explain E0518`.

0 commit comments

Comments
 (0)