cargo thiserror 1.0.5

latest releases: 1.0.59, 1.0.58, 1.0.57...
4 years ago
  • Support interpolating Path and PathBuf fields as if they had a Display impl

    use 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

Don't miss a new thiserror release

NewReleases is sending notifications on new releases.