Created
January 5, 2014 16:16
-
-
Save uzytkownik/8270151 to your computer and use it in GitHub Desktop.
Borrowing of owned pointer
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
pub fn get_str() -> ~str { | |
return ~"test"; | |
} | |
pub fn test(st : &str) { | |
let s = get_str(); | |
let s2 : &str = s; | |
assert_eq!(st, s2); | |
} | |
pub fn main() { | |
test("test"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment