aboutsummaryrefslogtreecommitdiffstats
path: root/components/util/opts.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-06-22 09:43:20 -0500
committerGitHub <noreply@github.com>2016-06-22 09:43:20 -0500
commit0fb5d634a007f3d0424f95569ac3f83d500d054c (patch)
tree55550a10bb3a7220282a8905c0eae3962f92ec21 /components/util/opts.rs
parent87d991ebd24886051ad1131bdbe3b9019cb1c4b3 (diff)
parentb103e8baa7145a125f5eb02debe0947ecc24776d (diff)
downloadservo-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/util/opts.rs')
-rw-r--r--components/util/opts.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/components/util/opts.rs b/components/util/opts.rs
index 323abc19d62..711782ab3ea 100644
--- a/components/util/opts.rs
+++ b/components/util/opts.rs
@@ -23,7 +23,8 @@ use url::{self, Url};
/// Global flags for Servo, currently set on the command line.
-#[derive(Clone, Deserialize, Serialize)]
+#[derive(Clone)]
+#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
pub struct Opts {
pub is_running_problem_test: bool,
@@ -379,7 +380,8 @@ pub fn print_debug_usage(app: &str) -> ! {
process::exit(0)
}
-#[derive(Clone, Deserialize, Serialize)]
+#[derive(Clone)]
+#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
pub enum OutputOptions {
FileName(String),
Stdout(f64)
@@ -404,7 +406,8 @@ enum UserAgent {
Android,
}
-#[derive(Clone, Debug, Eq, Deserialize, PartialEq, Serialize)]
+#[derive(Clone, Debug, Eq, PartialEq)]
+#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
pub enum RenderApi {
GL,
ES2,
@@ -858,7 +861,7 @@ pub fn set_defaults(opts: Opts) {
unsafe {
assert!(DEFAULT_OPTIONS.is_null());
assert!(DEFAULT_OPTIONS != INVALID_OPTIONS);
- let box_opts = box opts;
+ let box_opts = Box::new(opts);
DEFAULT_OPTIONS = Box::into_raw(box_opts);
}
}