#![feature(backtrace)]
use std::backtrace::Backtrace;
use thiserror::Error;
#[derive(Error, Debug)]
#[error("...")]
pub struct Error(#[from] #[backtrace] std::io::Error, Backtrace);
error[E0063]: missing field `1` in initializer of `Error`
--> src/main.rs:8:12
|
8 | pub struct Error(#[from] #[backtrace] std::io::Error, Backtrace);
| ^^^^^ missing `1`
With the following change it compiles successfully, which is expected:
- pub struct Error(#[from] #[backtrace] std::io::Error, Backtrace);
+ pub struct Error(#[from] std::io::Error, Backtrace);
and with the following change it produces a helpful diagnostic similar to what I think we should expect in the original case:
- pub struct Error(#[from] std::io::Error, Backtrace);
+ pub struct Error(#[from] std::io::Error, String);
error: deriving From requires no fields other than source and backtrace
--> src/main.rs:8:18
|
8 | pub struct Error(#[from] std::io::Error, String);
| ^^^^^^^
With the following change it compiles successfully, which is expected:
and with the following change it produces a helpful diagnostic similar to what I think we should expect in the original case: