-
-
Save steveklabnik/0422faad24f1dbf4410be0279e5219ed 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
fn add_to_mutable_reference(x: &mut i32) { | |
*x +=1; | |
} | |
#[test] | |
fn mutable_reference_test() { | |
let mut x = 5; | |
let y = &mut x; | |
mutable_reference(y); | |
assert_eq!(6, x); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment