diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-06-22 09:43:20 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-22 09:43:20 -0500 |
commit | 0fb5d634a007f3d0424f95569ac3f83d500d054c (patch) | |
tree | 55550a10bb3a7220282a8905c0eae3962f92ec21 /components/style/selector_matching.rs | |
parent | 87d991ebd24886051ad1131bdbe3b9019cb1c4b3 (diff) | |
parent | b103e8baa7145a125f5eb02debe0947ecc24776d (diff) | |
download | servo-0fb5d634a007f3d0424f95569ac3f83d500d054c.tar.gz servo-0fb5d634a007f3d0424f95569ac3f83d500d054c.zip |
Auto merge of #11816 - servo:stable-style, r=nox
Make the style crate (almost) build with a stable compiler
<!-- Please describe your changes on the following line: -->
The bulk of this is adding cargo features to make derived implementations of `heapsize` and `serde` traits optional.
"Almost" because `std::intrinsics::discriminant_value` is currently unstable and doesn’t have any stable replacement that I know of. For now, this PR conditionally replaces it with `unimplemented!()`.
r? @nox
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes <s>fix</s> are part of #11815 (github issue number if applicable).
<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not <s>require tests</s> *have tests yet* because that requires https://github.com/servo/servo/issues/11806, but I still want to land this before it bitrots. (Tests should check that the build succeeds with a stable compiler.)
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11816)
<!-- Reviewable:end -->
Diffstat (limited to 'components/style/selector_matching.rs')
-rw-r--r-- | components/style/selector_matching.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/components/style/selector_matching.rs b/components/style/selector_matching.rs index 79f590f5482..50bbf7dab49 100644 --- a/components/style/selector_matching.rs +++ b/components/style/selector_matching.rs @@ -44,7 +44,7 @@ lazy_static! { None, None, Origin::UserAgent, - box StdoutErrorReporter, + Box::new(StdoutErrorReporter), ParserContextExtraData::default()); stylesheets.push(ua_stylesheet); } @@ -56,7 +56,7 @@ lazy_static! { } for &(ref contents, ref url) in &opts::get().user_stylesheets { stylesheets.push(Stylesheet::from_bytes( - &contents, url.clone(), None, None, Origin::User, box StdoutErrorReporter, + &contents, url.clone(), None, None, Origin::User, Box::new(StdoutErrorReporter), ParserContextExtraData::default())); } stylesheets @@ -73,7 +73,7 @@ lazy_static! { None, None, Origin::UserAgent, - box StdoutErrorReporter, + Box::new(StdoutErrorReporter), ParserContextExtraData::default()) }, Err(..) => { @@ -100,7 +100,7 @@ lazy_static! { /// `ServoSelectorImpl`, the implementation used by Servo's layout system in /// regular builds, or `GeckoSelectorImpl`, the implementation used in the /// geckolib port. -#[derive(HeapSizeOf)] +#[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub struct Stylist<Impl: SelectorImplExt> { /// Device that the stylist is currently evaluating against. pub device: Device, @@ -269,7 +269,7 @@ impl<Impl: SelectorImplExt> Stylist<Impl> { properties::cascade(self.device.au_viewport_size(), &declarations, false, parent.map(|p| &**p), None, - box StdoutErrorReporter); + Box::new(StdoutErrorReporter)); Some(Arc::new(computed)) } else { parent.map(|p| p.clone()) @@ -302,7 +302,7 @@ impl<Impl: SelectorImplExt> Stylist<Impl> { properties::cascade(self.device.au_viewport_size(), &declarations, false, Some(&**parent), None, - box StdoutErrorReporter); + Box::new(StdoutErrorReporter)); Some(Arc::new(computed)) } @@ -438,7 +438,7 @@ impl<Impl: SelectorImplExt> Stylist<Impl> { } /// Map that contains the CSS rules for a given origin. -#[derive(HeapSizeOf)] +#[cfg_attr(feature = "servo", derive(HeapSizeOf))] struct PerOriginSelectorMap<Impl: SelectorImpl> { /// Rules that contains at least one property declararion with /// normal importance. @@ -460,7 +460,7 @@ impl<Impl: SelectorImpl> PerOriginSelectorMap<Impl> { /// Map that contains the CSS rules for a specific PseudoElement /// (or lack of PseudoElement). -#[derive(HeapSizeOf)] +#[cfg_attr(feature = "servo", derive(HeapSizeOf))] struct PerPseudoElementSelectorMap<Impl: SelectorImpl> { /// Rules from user agent stylesheets user_agent: PerOriginSelectorMap<Impl>, |