From 43287ca7f4ae7cbbe8d45e4c1dfc5fca7318d3e5 Mon Sep 17 00:00:00 2001 From: Scott Lamb Date: Thu, 22 Aug 2024 21:52:00 -0700 Subject: [PATCH] ensure `BuildError` impls `std::error::Error` Some usage in tracing expects this impl, as mentioned here: It's provided when `regex-automata` has its `std` feature enabled. As `matchers` uses `std` itself, no reason not to allow `regex-automata` to do so also. Seems like the most straightforward way to address the problem: * avoids the need to create a wrapper type. * less fragile than bumping `tracing-subscriber`'s `regex` dependency to 1.9.0 and hoping that all semver-compatible versions will continue depending on `regex-automata` with this `std` feature enabled. --- Cargo.toml | 2 +- src/lib.rs | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 3babdf7..8a74d1d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,7 @@ keywords = ["regex", "match", "pattern", "streaming"] maintenance = { status = "experimental" } [dependencies] -regex-automata = { version = "0.4", default-features = false, features = ["syntax", "dfa-build", "dfa-search"] } +regex-automata = { version = "0.4", default-features = false, features = ["std", "syntax", "dfa-build", "dfa-search"] } [features] unicode = ["regex-automata/unicode"] diff --git a/src/lib.rs b/src/lib.rs index fd05e07..2ccd9a9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -321,6 +321,14 @@ impl io::Write for Matcher { } } +const _: () = { + fn assert_is_std_error() {} + + fn assert_build_error_is_std_error() { + assert_is_std_error::(); + } +}; + #[cfg(test)] mod test { use super::*;