Add test for attribute error checking on trait and foreign items
This commit is contained in:
parent
af2b497776
commit
4552c8f2f7
2 changed files with 54 additions and 0 deletions
19
src/test/ui/lint/inline-trait-and-foreign-items.rs
Normal file
19
src/test/ui/lint/inline-trait-and-foreign-items.rs
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
#![feature(extern_types)]
|
||||||
|
|
||||||
|
trait Trait {
|
||||||
|
#[inline] //~ ERROR attribute should be applied to function or closure
|
||||||
|
const X: u32;
|
||||||
|
|
||||||
|
#[inline] //~ ERROR attribute should be applied to function or closure
|
||||||
|
type T;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern {
|
||||||
|
#[inline] //~ ERROR attribute should be applied to function or closure
|
||||||
|
static X: u32;
|
||||||
|
|
||||||
|
#[inline] //~ ERROR attribute should be applied to function or closure
|
||||||
|
type T;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
35
src/test/ui/lint/inline-trait-and-foreign-items.stderr
Normal file
35
src/test/ui/lint/inline-trait-and-foreign-items.stderr
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
error[E0518]: attribute should be applied to function or closure
|
||||||
|
--> $DIR/inline-trait-and-foreign-items.rs:12:5
|
||||||
|
|
|
||||||
|
LL | #[inline]
|
||||||
|
| ^^^^^^^^^
|
||||||
|
LL | static X: u32;
|
||||||
|
| -------------- not a function or closure
|
||||||
|
|
||||||
|
error[E0518]: attribute should be applied to function or closure
|
||||||
|
--> $DIR/inline-trait-and-foreign-items.rs:15:5
|
||||||
|
|
|
||||||
|
LL | #[inline]
|
||||||
|
| ^^^^^^^^^
|
||||||
|
LL | type T;
|
||||||
|
| ------- not a function or closure
|
||||||
|
|
||||||
|
error[E0518]: attribute should be applied to function or closure
|
||||||
|
--> $DIR/inline-trait-and-foreign-items.rs:4:5
|
||||||
|
|
|
||||||
|
LL | #[inline]
|
||||||
|
| ^^^^^^^^^
|
||||||
|
LL | const X: u32;
|
||||||
|
| ------------- not a function or closure
|
||||||
|
|
||||||
|
error[E0518]: attribute should be applied to function or closure
|
||||||
|
--> $DIR/inline-trait-and-foreign-items.rs:7:5
|
||||||
|
|
|
||||||
|
LL | #[inline]
|
||||||
|
| ^^^^^^^^^
|
||||||
|
LL | type T;
|
||||||
|
| ------- not a function or closure
|
||||||
|
|
||||||
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0518`.
|
Loading…
Add table
Add a link
Reference in a new issue