Last active
December 20, 2015 20:49
-
-
Save pnkfelix/6192665 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| struct S { x: int } | |
| impl S { | |
| fn f(self) { | |
| let mut ms = self; | |
| println(fmt!("self pre: %? ms pre: %?", self, ms)); | |
| ms.x = 4; | |
| println(fmt!("self post: %? ms post: %?", self, ms)); | |
| } | |
| } | |
| fn main() { | |
| let s = S { x: 3 }; | |
| s.f(); | |
| } |
This file contains hidden or 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
| % rustc /tmp/boz.rs && /tmp/boz | |
| warning: no debug symbols in executable (-arch x86_64) | |
| self pre: {x: 3} ms pre: {x: 3} | |
| self post: {x: 3} ms post: {x: 4} | |
| % |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment