rust/tests/ui/parser/recover/recover-missing-semi-before-item.rs
2024-02-16 20:02:50 +00:00

62 lines
1.1 KiB
Rust

//@ run-rustfix
#![allow(unused_variables, dead_code, unused_imports)]
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() {}