Created
August 21, 2013 21:55
-
-
Save bct/6300740 to your computer and use it in GitHub Desktop.
experimenting with string literal lifetimes
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 Error { | |
msg: &'static str | |
} | |
fn error(msg: &'static str) -> Error { | |
Error { msg: msg } | |
} | |
fn main() { | |
let err = error("successful syntax error"); | |
println(err.msg); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment