rust/tests/ui/use/use-after-move-self.rs
2023-01-11 09:32:08 +00:00

19 lines
266 B
Rust

struct S {
x: Box<isize>,
}
impl S {
pub fn foo(self) -> isize {
self.bar();
return *self.x; //~ ERROR use of moved value: `self`
}
pub fn bar(self) {}
}
fn main() {
let x = S { x: 1.into() };
println!("{}", x.foo());
}