diff --git a/Cargo.toml b/Cargo.toml index 23f3609..9fadb0a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thiserror" -version = "1.0.68" +version = "1.0.69" authors = ["David Tolnay "] categories = ["rust-patterns"] description = "derive(Error)" @@ -12,7 +12,7 @@ repository = "https://github.com/dtolnay/thiserror" rust-version = "1.61" [dependencies] -thiserror-impl = { version = "=1.0.68", path = "impl" } +thiserror-impl = { version = "=1.0.69", path = "impl" } [dev-dependencies] anyhow = "1.0.73" diff --git a/impl/Cargo.toml b/impl/Cargo.toml index 933831e..9936021 100644 --- a/impl/Cargo.toml +++ b/impl/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thiserror-impl" -version = "1.0.68" +version = "1.0.69" authors = ["David Tolnay "] description = "Implementation detail of the `thiserror` crate" edition = "2021" diff --git a/impl/src/fmt.rs b/impl/src/fmt.rs index 3d1394c..d2ab353 100644 --- a/impl/src/fmt.rs +++ b/impl/src/fmt.rs @@ -193,6 +193,8 @@ fn fallback_explicit_named_args(input: ParseStream) -> Result { let ident = input.call(Ident::parse_any)?; input.parse::()?; args.named.insert(ident); + } else { + input.parse::()?; } } diff --git a/src/lib.rs b/src/lib.rs index 30715fe..92662f4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -258,7 +258,7 @@ //! //! [`anyhow`]: https://github.com/dtolnay/anyhow -#![doc(html_root_url = "https://docs.rs/thiserror/1.0.68")] +#![doc(html_root_url = "https://docs.rs/thiserror/1.0.69")] #![allow( clippy::module_name_repetitions, clippy::needless_lifetimes, diff --git a/tests/ui/expression-fallback.rs b/tests/ui/expression-fallback.rs new file mode 100644 index 0000000..7269129 --- /dev/null +++ b/tests/ui/expression-fallback.rs @@ -0,0 +1,7 @@ +use thiserror::Error; + +#[derive(Error, Debug)] +#[error("".yellow)] +pub struct ArgError; + +fn main() {} diff --git a/tests/ui/expression-fallback.stderr b/tests/ui/expression-fallback.stderr new file mode 100644 index 0000000..5c9f215 --- /dev/null +++ b/tests/ui/expression-fallback.stderr @@ -0,0 +1,19 @@ +error: expected `,`, found `.` + --> tests/ui/expression-fallback.rs:4:11 + | +4 | #[error("".yellow)] + | ^ expected `,` + +error: argument never used + --> tests/ui/expression-fallback.rs:4:12 + | +4 | #[error("".yellow)] + | -- ^^^^^^ argument never used + | | + | formatting specifier missing + +error[E0425]: cannot find value `yellow` in this scope + --> tests/ui/expression-fallback.rs:4:12 + | +4 | #[error("".yellow)] + | ^^^^^^ not found in this scope