Skip to content

Instantly share code, notes, and snippets.

@bct
Created August 21, 2013 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bct/6300740 to your computer and use it in GitHub Desktop.
Save bct/6300740 to your computer and use it in GitHub Desktop.
experimenting with string literal lifetimes
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