Created
January 12, 2014 12:49
-
-
Save Kimundi/8384196 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum X { | |
A(~str), | |
B(~str) | |
} | |
struct Y { | |
x: X | |
} | |
fn f(a: &mut Y) { | |
let tmp = match a.x { | |
A(c) => c, | |
B(_) => fail!("Already B") | |
}; | |
a.x = B(tmp); | |
} | |
fn main() { | |
let mut a = Y { x: A(~"42") }; | |
f(&mut a); | |
} | |
ex.rs:12:9: 12:13 error: cannot move out of dereference of & pointer | |
ex.rs:12 A(c) => c, | |
^~~~ | |
error: aborting due to previous error | |
task 'rustc' failed at 'explicit failure', /home/florian/devel/rust/src/libsyntax/diagnostic.rs:75 | |
task '<main>' failed at 'explicit failure', /home/florian/devel/rust/src/librustc/lib.rs:453 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment