fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1// run-rustfix 2#![allow(unused)] 3enum Foo { 4 Foo1(Box<u32>, Box<u32>), 5 Foo2(Box<u32>), 6 Foo3, 7} 8 9 10 11fn blah() { 12 let f = &Foo::Foo1(Box::new(1), Box::new(2)); 13 match f { //~ ERROR cannot move out of 14 Foo::Foo1(num1, 15 num2) => (), 16 Foo::Foo2(num) => (), 17 Foo::Foo3 => () 18 } 19} 20 21struct S { 22 f: String, 23 g: String 24} 25impl Drop for S { 26 fn drop(&mut self) { println!("{}", self.f); } 27} 28 29fn move_in_match() { 30 match (S {f: "foo".to_string(), g: "bar".to_string()}) { 31 //~^ ERROR cannot move out of type `S`, which implements the `Drop` trait 32 S { 33 f: ref _s, 34 g: ref _t 35 } => {} 36 } 37} 38 39// from issue-8064 40struct A { 41 a: Box<isize>, 42} 43 44fn free<T>(_: T) {} 45 46fn blah2() { 47 let a = &A { a: Box::new(1) }; 48 match &a.a { //~ ERROR cannot move out of 49 n => { 50 free(n) 51 } 52 } 53 free(a) 54} 55 56fn main() {}