Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update rust crate thiserror to v2 - autoclosed #510

Closed
wants to merge 1 commit into from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Nov 11, 2024

This PR contains the following updates:

Package Type Update Change
thiserror dev-dependencies major 1.0.2 -> 2.0.0
thiserror dependencies major 1.0.2 -> 2.0.0

Release Notes

dtolnay/thiserror (thiserror)

v2.0.3

Compare Source

  • Support the same Path field being repeated in both Debug and Display representation in error message (#​383)
  • Improve error message when a format trait used in error message is not implemented by some field (#​384)

v2.0.2

Compare Source

  • Fix hang on invalid input inside #[error(...)] attribute (#​382)

v2.0.1

Compare Source

  • Support errors that contain a dynamically sized final field (#​375)
  • Improve inference of trait bounds for fields that are interpolated multiple times in an error message (#​377)

v2.0.0

Compare Source

Breaking changes

  • Referencing keyword-named fields by a raw identifier like {r#type} inside a format string is no longer accepted; simply use the unraw name like {type} (#​347)

    This aligns thiserror with the standard library's formatting macros, which gained support for implicit argument capture later than the release of this feature in thiserror 1.x.

    #[derive(Error, Debug)]
    #[error("... {type} ...")]  // Before: {r#type}
    pub struct Error {
        pub r#type: Type,
    }
  • Trait bounds are no longer inferred on fields whose value is shadowed by an explicit named argument in a format message (#​345)

    // Before: impl<T: Octal> Display for Error<T>
    // After: impl<T> Display for Error<T>
    #[derive(Error, Debug)]
    #[error("{thing:o}", thing = "...")]
    pub struct Error<T> {
        thing: T,
    }
  • Tuple structs and tuple variants can no longer use numerical {0} {1} access at the same time as supplying extra positional arguments for a format message, as this makes it ambiguous whether the number refers to a tuple field vs a different positional arg (#​354)

    #[derive(Error, Debug)]
    #[error("ambiguous: {0} {}", $N)]
    //                  ^^^ Not allowed, use #[error("... {0} {n}", n = $N)]
    pub struct TupleError(i32);
  • Code containing invocations of thiserror's derive(Error) must now have a direct dependency on the thiserror crate regardless of the error data structure's contents (#​368, #​369, #​370, #​372)

Features

  • Support disabling thiserror's standard library dependency by disabling the default "std" Cargo feature: thiserror = { version = "2", default-features = false } (#​373)

  • Support using r#source as field name to opt out of a field named "source" being treated as an error's Error::source() (#​350)

    #[derive(Error, Debug)]
    #[error("{source} ==> {destination}")]
    pub struct Error {
        r#source: char,
        destination: char,
    }
    
    let error = Error { source: 'S', destination: 'D' };
  • Infinite recursion in a generated Display impl now produces an unconditional_recursion warning (#​359)

    #[derive(Error, Debug)]
    #[error("??? {self}")]
    pub struct Error;
  • A new attribute #[error(fmt = path::to::myfmt)] can be used to write formatting logic for an enum variant out-of-line (#​367)

    #[derive(Error, Debug)]
    pub enum Error {
        #[error(fmt = demo_fmt)]
        Demo { code: u16, message: Option<String> },
    }
    
    fn demo_fmt(code: &u16, message: &Option<String>, formatter: &mut fmt::Formatter) -> fmt::Result {
        write!(formatter, "{code}")?;
        if let Some(msg) = message {
            write!(formatter, " - {msg}")?;
        }
        Ok(())
    }
  • Enums with an enum-level format message are now able to have individual variants that are transparent to supersede the enum-level message (#​366)

    #[derive(Error, Debug)]
    #[error("my error {0}")]
    pub enum Error {
        Json(#[from] serde_json::Error),
        Yaml(#[from] serde_yaml::Error),
        #[error(transparent)]
        Other(#[from] anyhow::Error),
    }

v1.0.69

Compare Source

  • Backport 2.0.2 fixes

v1.0.68

Compare Source

  • Handle incomplete expressions more robustly in format arguments, such as while code is being typed (#​341, #​344)

v1.0.67

Compare Source

v1.0.66

Compare Source

  • Improve compile error on malformed format attribute (#​327)

v1.0.65

Compare Source

  • Ensure OUT_DIR is left with deterministic contents after build script execution (#​325)

v1.0.64

Compare Source

v1.0.63

Compare Source

  • Documentation improvements

v1.0.62

Compare Source

  • Support referring to nested tuple struct fields inside #[error("…", …)] attribute (#​309)

v1.0.61

Compare Source

  • Use core::fmt and core::panic to facilitate error_in_core support (#​299, thanks @​jordens)

v1.0.60

Compare Source

  • Resolve unexpected_cfgs warning (#​298)

v1.0.59

Compare Source

  • Unblock testing of rustc debug-fmt-detail option (#​297)

v1.0.58

Compare Source

  • Make backtrace support available when using -Dwarnings (#​292)

v1.0.57

Compare Source

  • Generate more efficient Display impl for error message which do not contain any interpolated value (#​286, thanks @​nyurik)

v1.0.56

Compare Source

  • Update proc-macro2 to fix caching issue when using a rustc-wrapper such as sccache

v1.0.55

Compare Source

  • Work around improperly cached build script result by sccache – second attempt (#​280)

v1.0.54

Compare Source

  • Work around improperly cached build script result by sccache – first attempt (#​279)

v1.0.53

Compare Source

  • Reduce spurious rebuilds under RustRover IDE when using a nightly toolchain (#​270)

v1.0.52

Compare Source

  • Fix interaction with RUSTC_BOOTSTRAP (#​269)

v1.0.51

Compare Source

  • Improve diagnostics when an invalid attribute previously caused thiserror to generate no Error impl (#​266)

v1.0.50

Compare Source

  • Improve diagnostic when a #[source], #[from], or #[transparant] attribute refers to a type that has no std::error::Error impl (#​258, thanks @​de-vri-es)

v1.0.49

Compare Source

v1.0.48

Compare Source

  • Improve implementation of displaying Path values in a generated Display impl (#​251, thanks @​mina86)

v1.0.47

Compare Source

v1.0.46

Compare Source

  • Add bootstrap workaround to allow rustc to depend on thiserror (#​248, thanks @​RalfJung)

v1.0.45

Compare Source

v1.0.44

Compare Source

  • Documentation improvements

v1.0.43

Compare Source

v1.0.42

Compare Source

  • Fix compile error in derived Display impl if there was a nonstandard write! macro in scope (#​239)

v1.0.41

Compare Source

v1.0.40

Compare Source

  • Update syn dependency to 2.x

v1.0.39

Compare Source

  • Set html_root_url attribute

v1.0.38

Compare Source

  • Documentation improvements

v1.0.37

Compare Source

  • Documentation improvements

v1.0.36

Compare Source

v1.0.35

Compare Source

  • More work on integrating std::any::Provider for backtrace support
  • Fix "Multiple applicable provide methods in scope" error when the caller has both std::error::Error and std::any::Provide traits in scope (#​185)

v1.0.34

Compare Source

  • Tweak "generic member access" based Backtrace implementation (#​184)

v1.0.33

Compare Source

v1.0.32

Compare Source

  • Add keywords to crates.io metadata

v1.0.31

Compare Source

  • Improve diagnostic when there is an enum variant containing #[from] #[backtrace] Error, Backtrace (#​163)

v1.0.30

Compare Source

  • Make #[source] attribute usable on a field of type Box<dyn Error + Send + Sync + UnwindSafe + 'static> (#​155, thanks @​cosmicexplorer)

v1.0.29

Compare Source

  • Support error types containing generic type parameters (#​148, #​149, #​150, #​151)

    use thiserror::Error;
    
    #[derive(Error, Debug)]
    pub enum MyError<E, F, G> {
        #[error("thing {0} ({0:?})")]
        Variant(E),
        #[error("some error")]
        Delegate(#[source] SomeError<F>),
        #[error("err 0o{val:o}")]
        Octal { val: G },
    }

    In the above example, thiserror would automatically generate the following pair of generic trait impls.

    impl<E, F, G> std::error::Error for MyError<E, F, G>
    where
        SomeError<F>: std::error::Error + 'static,
        Self: std::fmt::Debug + std::fmt::Display;
    
    impl<E, F, G> std::fmt::Display for MyError<E, F, G>
    where
        E: std::fmt::Debug + std::fmt::Display,
        G: std::fmt::Octal;

v1.0.28

Compare Source

  • Make ? work with error types that hold an optional source (#​147)

v1.0.27

Compare Source

v1.0.26

Compare Source

v1.0.25

Compare Source

  • Support error(transparent) on errors containing a non-'static inner error (#​113)

v1.0.24

Compare Source

v1.0.23

Compare Source

  • Better diagnostic when putting non-static lifetimes into the source type of an error (#​115, #​116)

v1.0.22

Compare Source

  • Fix raw identifier fields in format arguments (#​108, thanks @​ninevra)

    #[derive(Error, Debug)]
    #[error("raw identifier: {r#type}")]
    pub struct Error {
        r#type: i32,
    }
  • Fix Rust keyword named format arguments (#​109)

    #[derive(Error, Debug)]
    #[error("keyword: {type}", type = 1)]
    pub struct Error;

v1.0.21

Compare Source

  • Support capturing backtraces inside of Arc from a From impl, which makes it possible for errors having backtraces to be clonable (#​102)

    use std::backtrace::Backtrace;
    use std::sync::Arc;
    use thiserror::Error;
    
    #[derive(Error, Debug, Clone)]
    #[error("...")]
    pub struct ClonableErrorWithBacktrace {
        #[from]
        source: Inner,
        #[backtrace]
        backtrace: Arc<Backtrace>,
    }

v1.0.20

Compare Source

  • Resolve unused_qualifications lint in generated code (#​91)

v1.0.19

Compare Source

  • Avoid triggering used_underscore_binding pedantic Clippy lint in generated code of #[error(transparent)] attribute (#​88)

v1.0.18

Compare Source

  • Fix compiler error in some cases when derive(Error) is invoked from inside of a macro_rules macro (#​86)

v1.0.17

Compare Source

  • Documentation improvements

v1.0.16

Compare Source

  • Catch misplaced #[error(transparent)] attributes (#​80, #​81)

v1.0.15

Compare Source

  • Improve error message when an error type is missing a Display impl (#​75)

v1.0.14

Compare Source

  • Avoid triggering deprecation warnings when an error enum has deprecated variants

v1.0.13

Compare Source

  • Fix failure to compile Display impl if a format string contained more than 1 named interpolated variable and a trailing comma, as in #[error("{v1} {v2}",)]

v1.0.12

Compare Source

  • Produce a better error message if a #[source] or #[from] field contains a non-'static lifetime (#​68)

v1.0.11

Compare Source

  • Ship license files in thiserror-impl subcrate also (#​63)

v1.0.10

Compare Source

  • Improve parsing of .0 and .var-style format arguments (#​54)

    For example the one here as the argument to the match expression would now be recognized correctly:

    #[derive(Error, Debug)]
    pub enum MyError {
        #[error("{}: {0}", match .1 {
            Some(n) => format!("a variant error occurred with n={}", n),
            None => format!("there was an empty variant error"),
        })]
        Variant(String, Option<usize>),
    }

v1.0.9

Compare Source

  • Fix bug affecting display attributes of the form #[error("{}", some_expression)] (where the format string is "{}" and nothing else, and the value formatted is not just one of the fields from the error) #​53

v1.0.8

Compare Source

  • Documentation improvements

v1.0.7

Compare Source

  • Support mixing shorthand and non-shorthand format args (#​47)

    #[derive(Error, Debug)]
    pub enum Error {
        #[error("first letter must be lowercase but was {:?}", first_char(.0))]
        WrongCase(String),
        #[error("invalid index {idx}, expected at least {} and at most {}", .limits.lo, .limits.hi)]
        OutOfBounds { idx: usize, limits: Limits },
    }
  • Add #[error(transparent)] attribute for delegating Error impl to one field (#​50)

    This is useful for hiding error variants from a library's public error type:

    #[derive(Error, Debug)]
    #[error(transparent)]  // source and Display delegate to ErrorKind
    pub struct Error(ErrorKind);
    
    #[derive(Error, Debug)]
    /*private*/ enum ErrorKind {
        #[error("...")]
        E0,
        #[error("...")]
        E1(#[source] io::Error),
    }

    And also for enums that need an "anything else" variant; such variants tend not to have their own Display message but just forward through to the underlying error's Display and source:

    #[derive(Error, Debug)]
    pub enum MyError {
        ...
    
        #[error(transparent)]
        Other(#[from] anyhow::Error),  // source and Display delegate to anyhow::Error
    }

v1.0.6

Compare Source

v1.0.5

Compare Source

  • 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

v1.0.4

Compare Source

  • Avoid generated variable name collision with an enum member named formatter (#​36, thanks @​mathstuf)

v1.0.3

Compare Source

  • Fix #[error("{v0}")] where an interpolated identifier contains number digits (#​34)

Configuration

📅 Schedule: Branch creation - "before 5am on monday" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about these updates again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot added the dependencies Dependency Management label Nov 11, 2024
@renovate renovate bot changed the title chore(deps): update rust crate thiserror to v2 chore(deps): update rust crate thiserror to v2 - autoclosed Nov 13, 2024
@renovate renovate bot closed this Nov 13, 2024
@renovate renovate bot deleted the renovate/thiserror-2.x branch November 13, 2024 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Dependency Management
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants