1 #### Note: this error code is no longer emitted by the compiler.
3 In a pattern, all values that don't implement the `Copy` trait have to be bound
4 the same way. The goal here is to avoid binding simultaneously by-move and
7 This limitation may be removed in a future version of Rust.
9 Erroneous code example:
12 #![feature(move_ref_pattern)]
16 let x = Some((X { x: () }, X { x: () }));
18 Some((y, ref z)) => {}, // error: cannot bind by-move and by-ref in the
24 You have two solutions:
26 Solution #1: Bind the pattern's values the same way.
31 let x = Some((X { x: () }, X { x: () }));
33 Some((ref y, ref z)) => {},
34 // or Some((y, z)) => {}
39 Solution #2: Implement the `Copy` trait for the `X` structure.
41 However, please keep in mind that the first solution should be preferred.
44 #[derive(Clone, Copy)]
47 let x = Some((X { x: () }, X { x: () }));
49 Some((y, ref z)) => {},