rust/tests/ui/suggestions/as-ref-2.rs
2023-01-11 09:32:08 +00:00

12 lines
207 B
Rust

struct Struct;
fn bar(_: &Struct) -> Struct {
Struct
}
fn main() {
let foo = Some(Struct);
let _x: Option<Struct> = foo.map(|s| bar(&s));
let _y = foo; //~ERROR use of moved value: `foo`
}