]> git.lizzy.rs Git - rust.git/blob - src/librustc_error_codes/error_codes/E0007.md
Auto merge of #66396 - smmalis37:pythontest, r=alexcrichton
[rust.git] / src / librustc_error_codes / error_codes / E0007.md
1 This error indicates that the bindings in a match arm would require a value to
2 be moved into more than one location, thus violating unique ownership. Code
3 like the following is invalid as it requires the entire `Option<String>` to be
4 moved into a variable called `op_string` while simultaneously requiring the
5 inner `String` to be moved into a variable called `s`.
6
7 Erroneous code example:
8
9 ```compile_fail,E0007
10 let x = Some("s".to_string());
11
12 match x {
13     op_string @ Some(s) => {}, // error: cannot bind by-move with sub-bindings
14     None => {},
15 }
16 ```
17
18 See also the error E0303.