Skip to content

Commit 43287ca

Browse files
committed
ensure BuildError impls std::error::Error
Some usage in tracing expects this impl, as mentioned here: <tokio-rs/tracing#3033 (review)> 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.
1 parent a73b203 commit 43287ca

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ keywords = ["regex", "match", "pattern", "streaming"]
1818
maintenance = { status = "experimental" }
1919

2020
[dependencies]
21-
regex-automata = { version = "0.4", default-features = false, features = ["syntax", "dfa-build", "dfa-search"] }
21+
regex-automata = { version = "0.4", default-features = false, features = ["std", "syntax", "dfa-build", "dfa-search"] }
2222

2323
[features]
2424
unicode = ["regex-automata/unicode"]

src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,14 @@ impl<A: Automaton> io::Write for Matcher<A> {
321321
}
322322
}
323323

324+
const _: () = {
325+
fn assert_is_std_error<T: std::error::Error>() {}
326+
327+
fn assert_build_error_is_std_error() {
328+
assert_is_std_error::<BuildError>();
329+
}
330+
};
331+
324332
#[cfg(test)]
325333
mod test {
326334
use super::*;

0 commit comments

Comments
 (0)