]> git.lizzy.rs Git - rust.git/blob - src/test/ui/use/use-after-move-self-based-on-type.rs
Merge commit 'cd4810de42c57b64b74dae09c530a4c3a41f87b9' into libgccjit-codegen
[rust.git] / src / test / ui / use / use-after-move-self-based-on-type.rs
1 struct S {
2     x: isize,
3 }
4
5 impl Drop for S {
6     fn drop(&mut self) {}
7 }
8
9 impl S {
10     pub fn foo(self) -> isize {
11         self.bar();
12         return self.x;  //~ ERROR use of moved value: `self`
13     }
14
15     pub fn bar(self) {}
16 }
17
18 fn main() {
19     let x = S { x: 1 };
20     println!("{}", x.foo());
21 }