Skip to content

Instantly share code, notes, and snippets.

@uzytkownik
Created January 5, 2014 16:16
Show Gist options
  • Save uzytkownik/8270151 to your computer and use it in GitHub Desktop.
Save uzytkownik/8270151 to your computer and use it in GitHub Desktop.
Borrowing of owned pointer
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