Last active
August 29, 2015 14:09
-
-
Save jnicklas/21f9c1230e64150827aa to your computer and use it in GitHub Desktop.
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
standard_error.rs:14:28: 14:35 error: cannot infer an appropriate lifetime for pattern due to conflicting requirements | |
standard_error.rs:14 StandardErrorWrapped(ref err) => err.description() | |
^~~~~~~ | |
standard_error.rs:14:40: 14:43 note: first, the lifetime cannot outlive the expression at 14:39... | |
standard_error.rs:14 StandardErrorWrapped(ref err) => err.description() | |
^~~ | |
standard_error.rs:14:40: 14:43 note: ...so that pointer is not dereferenced outside its lifetime | |
standard_error.rs:14 StandardErrorWrapped(ref err) => err.description() | |
^~~ | |
standard_error.rs:12:5: 15:6 note: but, the lifetime must be valid for the match at 12:4... | |
standard_error.rs:12 match *self { | |
standard_error.rs:13 StandardErrorActual { description: description } => description, | |
standard_error.rs:14 StandardErrorWrapped(ref err) => err.description() | |
standard_error.rs:15 } | |
standard_error.rs:14:28: 14:35 note: ...so that variable is valid at time of its declaration | |
standard_error.rs:14 StandardErrorWrapped(ref err) => err.description() | |
^~~~~~~ | |
error: aborting due to previous error |
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
#![feature(struct_variant)] | |
use std::error::Error; | |
enum StandardError { | |
StandardErrorActual { description: &'static str }, | |
StandardErrorWrapped(Box<Error+Send+'static>) | |
} | |
impl Error for StandardError { | |
fn description(&self) -> &'static str { | |
match *self { | |
StandardErrorActual { description: description } => description, | |
StandardErrorWrapped(ref err) => err.description() | |
} | |
} | |
fn detail(&self) -> Option<String> { | |
None | |
} | |
fn cause(&self) -> Option<&Error> { | |
None | |
} | |
} | |
fn main() { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment