.cargo/vendor/thiserror-1.0.59/tests/ui/lifetime.rs
raw| 1 | use std::fmt::Debug; |
| 2 | use thiserror::Error; |
| 3 | |
| 4 | #[derive(Error, Debug)] |
| 5 | #[error("error")] |
| 6 | struct Error<'a>(#[from] Inner<'a>); |
| 7 | |
| 8 | #[derive(Error, Debug)] |
| 9 | #[error("{0}")] |
| 10 | struct Inner<'a>(&'a str); |
| 11 | |
| 12 | #[derive(Error, Debug)] |
| 13 | enum Enum<'a> { |
| 14 | #[error("error")] |
| 15 | Foo(#[from] Generic<&'a str>), |
| 16 | } |
| 17 | |
| 18 | #[derive(Error, Debug)] |
| 19 | #[error("{0:?}")] |
| 20 | struct Generic<T: Debug>(T); |
| 21 | |
| 22 | fn main() -> Result<(), Error<'static>> { |
| 23 | Err(Error(Inner("some text"))) |
| 24 | } |