Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![allow(unreachable_code)]
- fn main() {
- println!("{:?}", {
- let mut x = Some(1); match x { Some(ref _y) => x = None, _ => () }; x
- });
- }
- /* ~~~~=== stderr ===~~~~
- Compiling playground v0.0.1 (file:///playground)
- error[E0506]: cannot assign to `x` because it is borrowed
- --> src/main.rs:6:56
- |
- 6 | let mut x = Some(1); match x { Some(ref _y) => x = None, _ => () }; x
- | ------ ^^^^^^^^ assignment to borrowed `x` occurs here
- | |
- | borrow of `x` occurs here
- error: aborting due to previous error
- For more information about this error, try `rustc --explain E0506`.
- error: Could not compile `playground`.
- To learn more, run the command again with --verbose.
- */
- /* ~~~~=== stdout ===~~~~
- */
Add Comment
Please, Sign In to add comment