-
Support interpolating
Path
andPathBuf
fields as if they had a Display impluse std::io; use std::path::PathBuf; use thiserror::Error; #[derive(Error, Debug)] pub enum Error { #[error("failed to load {1}")] Read(#[source] io::Error, PathBuf), }
In previous releases this would fail to compile with:
error[E0277]: `std::path::PathBuf` doesn't implement `std::fmt::Display` --> src/main.rs:7:13 | 7 | #[error("failed to load {1}")] | ^^^^^^^^^^^^^^^^^^^^ `std::path::PathBuf` cannot be formatted with the default formatter