-
-
Notifications
You must be signed in to change notification settings - Fork 183
Closed
Description
use thiserror::Error;
#[derive(Debug)]
pub struct S1(String);
#[derive(Debug)]
pub struct S2 {
inner: String,
}
#[derive(Debug, Error)]
pub enum BigError {
#[error("{:?}", .0)]
E1(S1),
#[error("{}", .0.inner)]
E2(S2),
#[error("{}", .0.0)]
E3(S2),
}
fn main() {
}
E1 and E2 compile.
E3 fails to compile with
error: expected expression, found `.`
--> src/main.rs:18:19
|
18 | #[error("{}", .0.0)]
| ^ expected expression
I found it a bit surprising - it seems like it should work.
Metadata
Metadata
Assignees
Labels
No labels