Conversation
0d65f79 to
7cad461
Compare
emilio
left a comment
There was a problem hiding this comment.
Could you split the less controversial patches into their own PR?
This patch breaks selectors and stylo pretty massively, btw... All of it fixable, but some of the fixes that are needed are a bit annoying, e.g.:
diff --git a/servo/components/style/media_queries/media_query.rs b/servo/components/style/media_queries/media_query.rs
index 9370c0a2a184..f0aad9b52ed4 100644
--- a/servo/components/style/media_queries/media_query.rs
+++ b/servo/components/style/media_queries/media_query.rs
@@ -50,7 +50,11 @@ impl MediaType {
// Here we also perform the to-ascii-lowercase part of the serialization
// algorithm: https://drafts.csswg.org/cssom/#serializing-media-queries
match_ignore_ascii_case! { name,
- "not" | "or" | "and" | "only" | "layer" => Err(()),
+ "not" => Err(()),
+ "or" => Err(()),
+ "and" => Err(()),
+ "only" => Err(()),
+ "layer" => Err(()),
_ => Ok(MediaType(CustomIdent(Atom::from(string_as_ascii_lowercase(name))))),
}
}
src/macros.rs
Outdated
| $( | ||
| $( #[$meta: meta] )* | ||
| $( $pattern: pat )|+ $( if $guard: expr )? => $then: expr | ||
| $pattern: literal $( if $guard: expr )? => $then: expr |
There was a problem hiding this comment.
This is a breaking change and one that makes the API a lot more annoying to use... That's a bit unfortunate?
There was a problem hiding this comment.
Ah, I didn't realise that selectors/stylo were also using these macros. I think it might be possible to add the repetition back into the macro (although the pat -> literal change would need to stay). Let me give that a go first.
There was a problem hiding this comment.
I've reinstated the repetition in the macro. In my testing, stylo and selectors now compile against this PR without any changes at all.
825219c to
355cf8f
Compare
emilio
left a comment
There was a problem hiding this comment.
Two nits, but looks good with those, thanks.
.github/workflows/main.yml
Outdated
| - 1.68.0 | ||
| - 1.71.0 | ||
| features: | ||
| - --no-default-features |
There was a problem hiding this comment.
Let's keep testing the default features by default please. Instead, let's add --no-default-features below.
Signed-off-by: Nico Burns <nico@nicoburns.com>
c7671f5 to
d5cabf3
Compare
emilio
left a comment
There was a problem hiding this comment.
Thanks! Consider squashing the "nits" commits into the relevant ones?
Signed-off-by: Nico Burns <nico@nicoburns.com>
Signed-off-by: Nico Burns <nico@nicoburns.com>
Signed-off-by: Nico Burns <nico@nicoburns.com>
d5cabf3 to
8cf964d
Compare
This PR makes all proc macros optional behind feature flags (and removes one completely, replacing it with const evaluation):
dummy_match_bytefeature (which disables the optimisedmatch_byte!macro and replaces it with a simplematchstatement) with afast_match_bytefeature which enables the optimisedmatch_byte!macro. This feature is enabled by default, but means if you build with--no-default-featuresthen you don't get the proc macro._cssparser_internal_max_lenproc macro with const evaluation.cssparser-macrosdep optional (only enabled byfast_match_bytefeature)Improve the syntax of theremovedascii_case_insensitive_phf_map!macro (see below)phfoptional for color keyword lookup. This is gated behind afast_match_colorfeature flag. When the flag is disabled theAll of the new feature flags are enabled by default, so if you use
cssparserwith default features enabled there is no change except for theascii_case_insensitive_phf_map!macro syntax.I have also bumped MSRV from 1.68 to 1.71. This is not actually related to this PR, but is required by recent patch versions of
syn(in fact, with this PRcssparserbuilds down to 1.63 with default features disabled, but I figure 1.71 is probably old enough?)With this PR dependency tree with no default features is just:
With default features it is:
`ascii_case_insensitive_phf_map` syntax changeremovedascii_case_insensitive_phf_mapsyntaxThe macro syntax was previously:
This uses the conventional Rust
:syntax for defining a type. And also makes it clearer that thekeywordsbit is anidentthat is being defined.