]> git.proxmox.com Git - rustc.git/blob - tests/ui/borrowck/borrowck-move-error-with-note.fixed
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / borrowck / borrowck-move-error-with-note.fixed
1 // run-rustfix
2 #![allow(unused)]
3 enum Foo {
4 Foo1(Box<u32>, Box<u32>),
5 Foo2(Box<u32>),
6 Foo3,
7 }
8
9
10
11 fn 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
21 struct S {
22 f: String,
23 g: String
24 }
25 impl Drop for S {
26 fn drop(&mut self) { println!("{}", self.f); }
27 }
28
29 fn 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
40 struct A {
41 a: Box<isize>,
42 }
43
44 fn free<T>(_: T) {}
45
46 fn 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
56 fn main() {}