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