1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
// run-rustfix
#![allow(unused_variables, dead_code)]
fn for_struct() {
let foo = 3; //~ ERROR expected `;`, found keyword `struct`
struct Foo;
}
fn for_union() {
let foo = 3; //~ ERROR expected `;`, found `union`
union Foo {
foo: usize,
}
}
fn for_enum() {
let foo = 3; //~ ERROR expected `;`, found keyword `enum`
enum Foo {
Bar,
}
}
fn for_fn() {
let foo = 3; //~ ERROR expected `;`, found keyword `fn`
fn foo() {}
}
fn for_extern() {
let foo = 3; //~ ERROR expected `;`, found keyword `extern`
extern fn foo() {}
}
fn for_impl() {
struct Foo;
let foo = 3; //~ ERROR expected `;`, found keyword `impl`
impl Foo {}
}
fn for_use() {
let foo = 3; //~ ERROR expected `;`, found keyword `pub`
pub use bar::Bar;
}
fn for_mod() {
let foo = 3; //~ ERROR expected `;`, found keyword `mod`
mod foo {}
}
fn for_type() {
let foo = 3; //~ ERROR expected `;`, found keyword `type`
type Foo = usize;
}
mod bar {
pub struct Bar;
}
const X: i32 = 123; //~ ERROR expected `;`, found keyword `fn`
fn main() {}
|