1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
```compile_fail
use super::Error;
use std::error::Error;
#[derive(Debug, Error)]
enum FromAttrWithArgs {
#[error(transparent)]
ErrorVariant(#[from("this shouldn't work")] std::io::Error),
}
```
*/
/**
The following test should fail to compile, as `Error::source` returns has a
'static bound on its return value.
As such, you can't use non-static lifetimes on an Error properly implementing
the `source` method.
```compile_fail
use core::error::Error;
use pisserror_macros::Error;
#[derive(Clone, Debug, Error)]
enum ErrorTyWeWillBorrowTickA {
#[error("")]
Variant,
}
#[derive(Clone, Debug, Error)]
enum MyError<'a> {
#[error("from err with non-static lifetime. this won't compile.")]
FromRefLt(#[from] &'a ErrorTyWeWillBorrowTickA),
}
```
*/