rust/tests/ui/borrowck/borrowck-storage-dead.rs
2023-01-11 09:32:08 +00:00

25 lines
260 B
Rust

fn ok() {
loop {
let _x = 1;
}
}
fn also_ok() {
loop {
let _x = String::new();
}
}
fn fail() {
loop {
let x: i32;
let _ = x + 1; //~ERROR [E0381]
}
}
fn main() {
ok();
also_ok();
fail();
}