aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2016-06-21 13:55:50 +0200
committerSimon Sapin <simon.sapin@exyr.org>2016-06-22 15:40:53 +0200
commitea73c8efac8c3544880bb9e037f884e0884a7736 (patch)
tree227b2f9689a95ddea92266ca557747ce615049c5
parentb9b289c4be50402facddd38c2ce2db2f1a05519c (diff)
downloadservo-ea73c8efac8c3544880bb9e037f884e0884a7736.tar.gz
servo-ea73c8efac8c3544880bb9e037f884e0884a7736.zip
Make it possible to build the style_traits crate with a stable compiler.
Testing this on CI to make sure we don’t regress it is blocked on #11806
-rw-r--r--components/gfx/Cargo.toml2
-rw-r--r--components/gfx/display_list/mod.rs3
-rw-r--r--components/msg/Cargo.toml4
-rw-r--r--components/profile/Cargo.toml2
-rw-r--r--components/script_traits/Cargo.toml2
-rw-r--r--components/servo/Cargo.lock3
-rw-r--r--components/style/Cargo.toml4
-rw-r--r--components/style/logical_geometry.rs3
-rw-r--r--components/style/properties/properties.mako.rs2
-rw-r--r--components/style_traits/Cargo.toml17
-rw-r--r--components/style_traits/cursor.rs4
-rw-r--r--components/style_traits/lib.rs17
-rw-r--r--components/style_traits/values.rs52
-rw-r--r--components/style_traits/viewport.rs7
-rw-r--r--components/util/Cargo.toml22
-rw-r--r--components/util/geometry.rs8
-rw-r--r--components/util/lib.rs60
-rw-r--r--components/util/opts.rs11
-rw-r--r--components/util/prefs.rs6
-rw-r--r--components/util/vec.rs5
20 files changed, 145 insertions, 89 deletions
diff --git a/components/gfx/Cargo.toml b/components/gfx/Cargo.toml
index 4a5dcba9a28..83ab6b25a91 100644
--- a/components/gfx/Cargo.toml
+++ b/components/gfx/Cargo.toml
@@ -13,7 +13,7 @@ path = "lib.rs"
app_units = {version = "0.2.3", features = ["plugins"]}
azure = {git = "https://github.com/servo/rust-azure", features = ["plugins"]}
bitflags = "0.7"
-euclid = {version = "0.6.4", features = ["plugins"]}
+euclid = {version = "0.6.4", features = ["plugins", "unstable"]}
fnv = "1.0"
gfx_traits = {path = "../gfx_traits"}
harfbuzz-sys = "0.1"
diff --git a/components/gfx/display_list/mod.rs b/components/gfx/display_list/mod.rs
index 1ec5aaf0d14..ac93adcca1f 100644
--- a/components/gfx/display_list/mod.rs
+++ b/components/gfx/display_list/mod.rs
@@ -20,7 +20,8 @@ use azure::azure_hl::Color;
use euclid::approxeq::ApproxEq;
use euclid::num::Zero;
use euclid::rect::TypedRect;
-use euclid::{Matrix2D, Matrix4D, Point2D, Rect, SideOffsets2D, Size2D};
+use euclid::side_offsets::SideOffsets2D;
+use euclid::{Matrix2D, Matrix4D, Point2D, Rect, Size2D};
use fnv::FnvHasher;
use gfx_traits::{LayerId, ScrollPolicy, StackingContextId};
use ipc_channel::ipc::IpcSharedMemory;
diff --git a/components/msg/Cargo.toml b/components/msg/Cargo.toml
index 13e2ae8f863..ac3a967802d 100644
--- a/components/msg/Cargo.toml
+++ b/components/msg/Cargo.toml
@@ -21,6 +21,6 @@ plugins = {path = "../plugins"}
rustc-serialize = "0.3.4"
serde = "0.7"
serde_macros = "0.7"
-url = {version = "1.0.0", features = ["heap_size"]}
-util = {path = "../util"}
+url = {version = "1.0.0", features = ["heap_size", "serde"]}
+util = {path = "../util", features = ["servo"]}
webrender_traits = {git = "https://github.com/servo/webrender_traits"}
diff --git a/components/profile/Cargo.toml b/components/profile/Cargo.toml
index ad7ab35a9d8..da8d01ca514 100644
--- a/components/profile/Cargo.toml
+++ b/components/profile/Cargo.toml
@@ -11,7 +11,7 @@ path = "lib.rs"
[dependencies]
profile_traits = {path = "../profile_traits"}
plugins = {path = "../plugins"}
-util = {path = "../util"}
+util = {path = "../util", features = ["servo"]}
ipc-channel = {git = "https://github.com/servo/ipc-channel"}
heartbeats-simple = "0.3"
log = "0.3.5"
diff --git a/components/script_traits/Cargo.toml b/components/script_traits/Cargo.toml
index 39755274168..f1e21ca27b6 100644
--- a/components/script_traits/Cargo.toml
+++ b/components/script_traits/Cargo.toml
@@ -15,7 +15,7 @@ msg = {path = "../msg"}
net_traits = {path = "../net_traits"}
plugins = {path = "../plugins"}
profile_traits = {path = "../profile_traits"}
-style_traits = {path = "../style_traits"}
+style_traits = {path = "../style_traits", features = ["serde-serialization"]}
util = {path = "../util"}
devtools_traits = {path = "../devtools_traits"}
ipc-channel = {git = "https://github.com/servo/ipc-channel"}
diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock
index 10b36f51793..872f9dddaaf 100644
--- a/components/servo/Cargo.lock
+++ b/components/servo/Cargo.lock
@@ -2253,7 +2253,6 @@ dependencies = [
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "plugins 0.0.1",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2438,7 +2437,6 @@ dependencies = [
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)",
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2446,7 +2444,6 @@ dependencies = [
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
- "plugins 0.0.1",
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/components/style/Cargo.toml b/components/style/Cargo.toml
index 98492645bc7..4208b10a364 100644
--- a/components/style/Cargo.toml
+++ b/components/style/Cargo.toml
@@ -34,10 +34,10 @@ serde = {version = "0.7", features = ["nightly"]}
serde_macros = "0.7"
smallvec = "0.1"
string_cache = {version = "0.2.20", features = ["heap_size"]}
-style_traits = {path = "../style_traits"}
+style_traits = {path = "../style_traits", features = ["heap_size"]}
time = "0.1"
url = {version = "1.0.0", features = ["heap_size"]}
-util = {path = "../util"}
+util = {path = "../util", features = ["servo"]}
[build-dependencies]
walkdir = "0.1"
diff --git a/components/style/logical_geometry.rs b/components/style/logical_geometry.rs
index b6afaf6f540..849fcc97f8d 100644
--- a/components/style/logical_geometry.rs
+++ b/components/style/logical_geometry.rs
@@ -5,7 +5,8 @@
//! Geometry in flow-relative space.
use euclid::num::Zero;
-use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
+use euclid::side_offsets::SideOffsets2D;
+use euclid::{Point2D, Rect, Size2D};
use std::cmp::{max, min};
use std::fmt::{self, Debug, Error, Formatter};
use std::ops::{Add, Sub};
diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs
index 3d41c30366b..a65c9fb713c 100644
--- a/components/style/properties/properties.mako.rs
+++ b/components/style/properties/properties.mako.rs
@@ -25,7 +25,7 @@ use cssparser::{Parser, RGBA, AtRuleParser, DeclarationParser, Delimiter,
DeclarationListParser, parse_important, ToCss, TokenSerializationType};
use error_reporting::ParseErrorReporter;
use url::Url;
-use euclid::SideOffsets2D;
+use euclid::side_offsets::SideOffsets2D;
use euclid::size::Size2D;
use string_cache::Atom;
use computed_values;
diff --git a/components/style_traits/Cargo.toml b/components/style_traits/Cargo.toml
index b089931d3cb..b8dd5079e95 100644
--- a/components/style_traits/Cargo.toml
+++ b/components/style_traits/Cargo.toml
@@ -8,13 +8,16 @@ publish = false
name = "style_traits"
path = "lib.rs"
+[features]
+heap_size = ["heapsize", "heapsize_plugin", "cssparser/heap_size", "euclid/plugins"]
+serde-serialization = ["serde", "serde_macros", "cssparser/serde-serialization", "euclid/plugins"]
+
[dependencies]
util = {path = "../util"}
-plugins = {path = "../plugins"}
-cssparser = {version = "0.5.4", features = ["heap_size", "serde-serialization"]}
-euclid = {version = "0.6.4", features = ["plugins"]}
-heapsize = "0.3.0"
-heapsize_plugin = "0.1.2"
+cssparser = "0.5.4"
+euclid = "0.6.4"
+heapsize = {version = "0.3.0", optional = true}
+heapsize_plugin = {version = "0.1.2", optional = true}
rustc-serialize = "0.3"
-serde = "0.7"
-serde_macros = "0.7"
+serde = {version = "0.7", optional = true}
+serde_macros = {version = "0.7", optional = true}
diff --git a/components/style_traits/cursor.rs b/components/style_traits/cursor.rs
index be1d9b3c0b3..722a69a499a 100644
--- a/components/style_traits/cursor.rs
+++ b/components/style_traits/cursor.rs
@@ -8,7 +8,9 @@ use cssparser::ToCss;
macro_rules! define_cursor {
($( $css: expr => $variant: ident = $value: expr, )+) => {
- #[derive(Clone, Copy, Debug, Deserialize, Eq, HeapSizeOf, PartialEq, Serialize)]
+ #[derive(Clone, Copy, Debug, Eq, PartialEq)]
+ #[cfg_attr(feature = "serde-serialization", derive(Deserialize, Serialize))]
+ #[cfg_attr(feature = "heap_size", derive(HeapSizeOf))]
#[repr(u8)]
pub enum Cursor {
$( $variant = $value ),+
diff --git a/components/style_traits/lib.rs b/components/style_traits/lib.rs
index 5cb01bb8c03..8cb3cb3769d 100644
--- a/components/style_traits/lib.rs
+++ b/components/style_traits/lib.rs
@@ -8,19 +8,22 @@
#![crate_name = "style_traits"]
#![crate_type = "rlib"]
-#![feature(custom_derive)]
-#![feature(plugin)]
-#![plugin(heapsize_plugin)]
-#![plugin(serde_macros)]
-#![plugin(plugins)]
+
#![deny(unsafe_code)]
+#![cfg_attr(feature = "serde-serialization", feature(custom_derive))]
+#![cfg_attr(feature = "serde-serialization", feature(plugin))]
+#![cfg_attr(feature = "serde-serialization", plugin(serde_macros))]
+#![cfg_attr(feature = "heap_size", feature(custom_derive))]
+#![cfg_attr(feature = "heap_size", feature(plugin))]
+#![cfg_attr(feature = "heap_size", plugin(heapsize_plugin))]
+
#[macro_use]
extern crate cssparser;
extern crate euclid;
-extern crate heapsize;
+#[cfg(feature = "heap_size")] extern crate heapsize;
extern crate rustc_serialize;
-extern crate serde;
+#[cfg(feature = "serde-serialization")] extern crate serde;
extern crate util;
pub mod cursor;
diff --git a/components/style_traits/values.rs b/components/style_traits/values.rs
index 5b9226f324e..6139e2f5b53 100644
--- a/components/style_traits/values.rs
+++ b/components/style_traits/values.rs
@@ -5,12 +5,58 @@
#[macro_export]
macro_rules! define_css_keyword_enum {
($name: ident: $( $css: expr => $variant: ident ),+,) => {
- define_css_keyword_enum!($name: $( $css => $variant ),+);
+ __define_css_keyword_enum__add_serde!($name [ $( $css => $variant ),+ ]);
};
($name: ident: $( $css: expr => $variant: ident ),+) => {
+ __define_css_keyword_enum__add_serde!($name [ $( $css => $variant ),+ ]);
+ };
+}
+
+#[cfg(feature = "serde-serialization")]
+#[macro_export]
+macro_rules! __define_css_keyword_enum__add_serde {
+ ($name: ident [ $( $css: expr => $variant: ident ),+ ]) => {
+ __define_css_keyword_enum__add_heapsize! {
+ $name [ Deserialize, Serialize ] [ $( $css => $variant ),+ ]
+ }
+ };
+}
+
+#[cfg(not(feature = "serde-serialization"))]
+#[macro_export]
+macro_rules! __define_css_keyword_enum__add_serde {
+ ($name: ident [ $( $css: expr => $variant: ident ),+ ]) => {
+ __define_css_keyword_enum__add_heapsize! {
+ $name [] [ $( $css => $variant ),+ ]
+ }
+ };
+}
+
+#[cfg(feature = "heap_size")]
+#[macro_export]
+macro_rules! __define_css_keyword_enum__add_heapsize {
+ ($name: ident [ $( $derived_trait: ident),* ] [ $( $css: expr => $variant: ident ),+ ]) => {
+ __define_css_keyword_enum__actual! {
+ $name [ $( $derived_trait, )* HeapSizeOf ] [ $( $css => $variant ),+ ]
+ }
+ };
+}
+
+#[cfg(not(feature = "heap_size"))]
+#[macro_export]
+macro_rules! __define_css_keyword_enum__add_heapsize {
+ ($name: ident [ $( $derived_trait: ident),* ] [ $( $css: expr => $variant: ident ),+ ]) => {
+ __define_css_keyword_enum__actual! {
+ $name [ $( $derived_trait ),* ] [ $( $css => $variant ),+ ]
+ }
+ };
+}
+
+#[macro_export]
+macro_rules! __define_css_keyword_enum__actual {
+ ($name: ident [ $( $derived_trait: ident),* ] [ $( $css: expr => $variant: ident ),+ ]) => {
#[allow(non_camel_case_types)]
- #[derive(Clone, Eq, PartialEq, Copy, Hash, RustcEncodable, Debug, HeapSizeOf)]
- #[derive(Deserialize, Serialize)]
+ #[derive(Clone, Eq, PartialEq, Copy, Hash, RustcEncodable, Debug $(, $derived_trait )* )]
pub enum $name {
$( $variant ),+
}
diff --git a/components/style_traits/viewport.rs b/components/style_traits/viewport.rs
index f8b89ae4de6..ad71b8257cf 100644
--- a/components/style_traits/viewport.rs
+++ b/components/style_traits/viewport.rs
@@ -20,7 +20,9 @@ define_css_keyword_enum!(Orientation:
"landscape" => Landscape);
-#[derive(Clone, Debug, PartialEq, Deserialize, Serialize, HeapSizeOf)]
+#[derive(Clone, Debug, PartialEq)]
+#[cfg_attr(feature = "serde-serialization", derive(Deserialize, Serialize))]
+#[cfg_attr(feature = "heap_size", derive(HeapSizeOf))]
pub struct ViewportConstraints {
pub size: TypedSize2D<ViewportPx, f32>,
@@ -54,7 +56,8 @@ impl ToCss for ViewportConstraints {
/// Zoom is a number | percentage | auto
/// See http://dev.w3.org/csswg/css-device-adapt/#descdef-viewport-zoom
-#[derive(Copy, Clone, Debug, HeapSizeOf, PartialEq)]
+#[derive(Copy, Clone, Debug, PartialEq)]
+#[cfg_attr(feature = "heap_size", derive(HeapSizeOf))]
pub enum Zoom {
Number(f32),
Percentage(f32),
diff --git a/components/util/Cargo.toml b/components/util/Cargo.toml
index 40c8f56a64b..334e474f56b 100644
--- a/components/util/Cargo.toml
+++ b/components/util/Cargo.toml
@@ -8,28 +8,30 @@ publish = false
name = "util"
path = "lib.rs"
+[features]
+# servo as opposed to geckolib
+servo = ["serde", "serde_macros", "backtrace", "ipc-channel", "bitflags"]
+
[dependencies]
-app_units = {version = "0.2.3", features = ["plugins"]}
-backtrace = "0.2.1"
-bitflags = "0.7"
+app_units = {version = "0.2.3"}
+backtrace = {version = "0.2.1", optional = true}
+bitflags = {version = "0.7", optional = true}
deque = "0.3.1"
-euclid = {version = "0.6.4", features = ["unstable", "plugins"]}
+euclid = {version = "0.6.4"}
getopts = "0.2.11"
heapsize = "0.3.0"
-heapsize_plugin = "0.1.2"
-ipc-channel = {git = "https://github.com/servo/ipc-channel"}
+ipc-channel = {git = "https://github.com/servo/ipc-channel", optional = true}
lazy_static = "0.2"
libc = "0.2"
log = "0.3.5"
num_cpus = "0.2.2"
num-traits = "0.1.32"
-plugins = {path = "../plugins"}
rand = "0.3"
rustc-serialize = "0.3"
-serde = "0.7"
-serde_macros = "0.7"
+serde = {version = "0.7", optional = true}
+serde_macros = {version = "0.7", optional = true}
smallvec = "0.1"
-url = {version = "1.0.0", features = ["heap_size", "serde"]}
+url = {version = "1.0.0"}
[target.'cfg(all(unix, not(target_os = "macos"), not(target_os = "ios"), not(target_os = "android")))'.dependencies]
xdg = "2.0"
diff --git a/components/util/geometry.rs b/components/util/geometry.rs
index 813cad3aa3d..d750131f151 100644
--- a/components/util/geometry.rs
+++ b/components/util/geometry.rs
@@ -23,7 +23,7 @@ use std::i32;
///
/// The ratio between ScreenPx and DevicePixel for a given display be found by calling
/// `servo::windowing::WindowMethods::hidpi_factor`.
-#[derive(Clone, Copy, Debug, HeapSizeOf)]
+#[derive(Clone, Copy, Debug)]
pub enum ScreenPx {}
/// One CSS "px" in the coordinate system of the "initial viewport":
@@ -35,7 +35,7 @@ pub enum ScreenPx {}
///
/// At the default zoom level of 100%, one PagePx is equal to one ScreenPx. However, if the
/// document is zoomed in or out then this scale may be larger or smaller.
-#[derive(Clone, Copy, Debug, HeapSizeOf)]
+#[derive(Clone, Copy, Debug)]
pub enum ViewportPx {}
/// One CSS "px" in the root coordinate system for the content document.
@@ -44,9 +44,11 @@ pub enum ViewportPx {}
/// This is the mobile-style "pinch zoom" that enlarges content without reflowing it. When the
/// viewport zoom is not equal to 1.0, then the layout viewport is no longer the same physical size
/// as the viewable area.
-#[derive(Clone, Copy, Debug, HeapSizeOf)]
+#[derive(Clone, Copy, Debug)]
pub enum PagePx {}
+known_heap_size!(0, ScreenPx, ViewportPx, PagePx);
+
// In summary, the hierarchy of pixel units and the factors to convert from one to the next:
//
// DevicePixel
diff --git a/components/util/lib.rs b/components/util/lib.rs
index 6417fe40a45..8fe46dd6f7a 100644
--- a/components/util/lib.rs
+++ b/components/util/lib.rs
@@ -2,39 +2,31 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#![feature(box_syntax)]
-#![feature(core_intrinsics)]
-#![feature(custom_derive)]
-#![feature(fnbox)]
-#![feature(plugin)]
-#![feature(reflect_marker)]
-#![feature(step_by)]
-
-#![plugin(heapsize_plugin, plugins, serde_macros)]
+#![cfg_attr(feature = "servo", feature(core_intrinsics))]
+#![cfg_attr(feature = "servo", feature(custom_derive))]
+#![cfg_attr(feature = "servo", feature(fnbox))]
+#![cfg_attr(feature = "servo", feature(plugin))]
+#![cfg_attr(feature = "servo", feature(reflect_marker))]
+#![cfg_attr(feature = "servo", plugin(serde_macros))]
#![deny(unsafe_code)]
extern crate app_units;
-extern crate backtrace;
-#[allow(unused_extern_crates)]
-#[macro_use]
-extern crate bitflags;
+#[cfg(feature = "servo")] extern crate backtrace;
+#[cfg(feature = "servo")] #[allow(unused_extern_crates)] #[macro_use] extern crate bitflags;
extern crate deque;
extern crate euclid;
extern crate getopts;
-extern crate heapsize;
-extern crate ipc_channel;
-#[allow(unused_extern_crates)]
-#[macro_use]
-extern crate lazy_static;
+#[macro_use] extern crate heapsize;
+#[cfg(feature = "servo")] extern crate ipc_channel;
+#[allow(unused_extern_crates)] #[macro_use] extern crate lazy_static;
extern crate libc;
-#[macro_use]
-extern crate log;
+#[macro_use] extern crate log;
extern crate num_cpus;
extern crate num_traits;
extern crate rand;
extern crate rustc_serialize;
-extern crate serde;
+#[cfg(feature = "servo")] extern crate serde;
extern crate smallvec;
extern crate url;
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "ios"), not(target_os = "android")))]
@@ -44,28 +36,24 @@ use std::sync::Arc;
pub mod basedir;
pub mod cache;
-#[allow(unsafe_code)]
-pub mod debug_utils;
+#[allow(unsafe_code)] pub mod debug_utils;
pub mod geometry;
-#[allow(unsafe_code)]
-pub mod ipc;
-pub mod linked_list;
-#[allow(unsafe_code)]
-pub mod opts;
-pub mod panicking;
+#[cfg(feature = "servo")] #[allow(unsafe_code)] pub mod ipc;
+#[cfg(feature = "servo")] pub mod linked_list;
+#[allow(unsafe_code)] pub mod opts;
+#[cfg(feature = "servo")] pub mod panicking;
pub mod prefs;
-pub mod print_tree;
+#[cfg(feature = "servo")] pub mod print_tree;
pub mod resource_files;
-#[allow(unsafe_code)]
pub mod str;
-pub mod thread;
-pub mod thread_state;
+#[cfg(feature = "servo")] pub mod thread;
+#[cfg(feature = "servo")] pub mod thread_state;
pub mod tid;
-pub mod time;
+#[cfg(feature = "servo")] pub mod time;
pub mod vec;
-#[allow(unsafe_code)]
-pub mod workqueue;
+#[cfg(feature = "servo")] #[allow(unsafe_code)] pub mod workqueue;
+#[cfg(feature = "servo")]
#[allow(unsafe_code)]
pub fn breakpoint() {
unsafe { ::std::intrinsics::breakpoint() };
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);
}
}
diff --git a/components/util/prefs.rs b/components/util/prefs.rs
index 9c713df02e9..55c856fa747 100644
--- a/components/util/prefs.rs
+++ b/components/util/prefs.rs
@@ -20,7 +20,8 @@ lazy_static! {
};
}
-#[derive(PartialEq, Clone, Debug, Deserialize, Serialize)]
+#[derive(PartialEq, Clone, Debug)]
+#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
pub enum PrefValue {
Boolean(bool),
String(String),
@@ -91,7 +92,8 @@ impl ToJson for PrefValue {
}
}
-#[derive(Clone, Debug, Deserialize, Serialize)]
+#[derive(Clone, Debug)]
+#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
pub enum Pref {
NoDefault(Arc<PrefValue>),
WithDefault(Arc<PrefValue>, Option<Arc<PrefValue>>)
diff --git a/components/util/vec.rs b/components/util/vec.rs
index 5342d452020..639e1c260da 100644
--- a/components/util/vec.rs
+++ b/components/util/vec.rs
@@ -9,10 +9,13 @@ use super::smallvec::VecLike;
// TODO(pcwalton): Speed up with SIMD, or better yet, find some way to not do this.
pub fn byte_swap(data: &mut [u8]) {
let length = data.len();
- for i in (0..length).step_by(4) {
+ // FIXME(rust #27741): Range::step_by is not stable yet as of this writing.
+ let mut i = 0;
+ while i < length {
let r = data[i + 2];
data[i + 2] = data[i + 0];
data[i + 0] = r;
+ i += 4;
}
}