2012-12-10 19:58:37 +00:00
|
|
|
struct S {
|
2015-01-08 10:54:35 +00:00
|
|
|
x: Box<isize>,
|
2012-12-10 19:58:37 +00:00
|
|
|
}
|
|
|
|
|
2021-08-25 00:39:40 +00:00
|
|
|
|
|
|
|
|
2013-05-31 22:17:22 +00:00
|
|
|
impl S {
|
2015-01-08 10:54:35 +00:00
|
|
|
pub fn foo(self) -> isize {
|
2013-01-10 18:59:58 +00:00
|
|
|
self.bar();
|
2019-04-22 07:40:08 +00:00
|
|
|
return *self.x; //~ ERROR use of moved value: `self`
|
2012-12-10 19:58:37 +00:00
|
|
|
}
|
|
|
|
|
2013-05-31 22:17:22 +00:00
|
|
|
pub fn bar(self) {}
|
2012-12-10 19:58:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2021-08-25 00:39:40 +00:00
|
|
|
let x = S { x: 1.into() };
|
2014-01-09 10:06:55 +00:00
|
|
|
println!("{}", x.foo());
|
2012-12-10 19:58:37 +00:00
|
|
|
}
|