blob: 464f01ca74c827c927ccb1eed87b39f6cf44b2de [file] [log] [blame]
#![feature(box_patterns)]
#![feature(box_syntax)]
use std::ops::Add;
#[derive(Clone)]
struct Foo(Box<usize>);
impl Add for Foo {
type Output = Foo;
fn add(self, f: Foo) -> Foo {
let Foo(box i) = self;
let Foo(box j) = f;
Foo(box (i + j))
}
}
fn main() {
let x = Foo(box 3);
let _y = {x} + x.clone(); // the `{x}` forces a move to occur
//~^ ERROR use of moved value: `x`
}