Skip to content

Commit b490e0b

Browse files
authoredApr 17, 2020
cargo: tweak features for regex-syntax
This commit tweaks the features enabled for the `regex-syntax` crate from the `regex` crate itself. This isn't intended to actually have any functional change, but should help feature unification for Cargo in some projects. One project I work on exhibits an issue where executing `cargo build` followed by `cargo test` will rebuild `regex-syntax` and all of its transitive dependencies. The cause for this issue is that the tests are using the `proptest` crate. The `proptest` crate depends on `regex-syntax` with normal features (e.g. the defaults). All other crates depend on `regex` with normal default features too. The problem happens where when *only* the `regex` crate depends on `regex-syntax` then the `default` and `unicode` features of `regex-syntax` are disabled. This is because the `regex` crate disables default features and `regex`'s `unicode` feature delegates to all the individual features of `regex-syntax`. When the `regex-syntax` crate is depended on directly by `proptest` it then enables the `default` and `unicode` features of `regex-syntax`. Functionally these two builds of `regex-syntax` are exactly the same since `default` is simply a proxy for `unicode` and `unicode` is simply an umbrella including other features. This PR updates the features enabled on `regex-syntax` by the `regex` crate in two ways: * The `default` feature for `regex` enables `regex-syntax/default`. * The `unicode` feature for `regex` enables the `regex-syntax/unicode` feature. This makes is so that if another crate in your crate graph depends on `regex-syntax` then it'll have, by default, the same set of features enabled than if you also depend on `regex`. PR #665
1 parent 3221cdb commit b490e0b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ doctest = false
3131
# Features are documented in the "Crate features" section of the crate docs:
3232
# https://docs.rs/regex/*/#crate-features
3333
[features]
34-
default = ["std", "perf", "unicode"]
34+
default = ["std", "perf", "unicode", "regex-syntax/default"]
3535

3636
# ECOSYSTEM FEATURES
3737

@@ -71,6 +71,7 @@ unicode = [
7171
"unicode-perl",
7272
"unicode-script",
7373
"unicode-segment",
74+
"regex-syntax/unicode",
7475
]
7576
# Enables use of the `Age` property, e.g., `\p{Age:3.0}`.
7677
unicode-age = ["regex-syntax/unicode-age"]

0 commit comments

Comments
 (0)
Please sign in to comment.