Skip to content

Bump serde to 1.0 #1359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
225 changes: 127 additions & 98 deletions Cargo.lock

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions webrender/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,36 @@ profiler = ["thread_profiler/thread_profiler"]
webgl = ["offscreen_gl_context", "webrender_traits/webgl"]

[dependencies]
app_units = "0.4"
bincode = "1.0.0-alpha6"
app_units = "0.5"
bincode = "0.8"
bit-set = "0.4"
byteorder = "1.0"
euclid = "0.14.4"
euclid = "0.15"
fnv = "1.0"
gleam = "0.4.3"
lazy_static = "0.2"
log = "0.3"
num-traits = "0.1.32"
offscreen_gl_context = {version = "0.9.0", features = ["serde", "osmesa"], optional = true}
offscreen_gl_context = {version = "0.11", features = ["serde", "osmesa"], optional = true}
time = "0.1"
rayon = "0.8"
webrender_traits = {path = "../webrender_traits"}
bitflags = "0.7"
gamma-lut = "0.2"
thread_profiler = "0.1.1"
plane-split = "0.5"
plane-split = "0.6"

[dev-dependencies]
angle = {git = "https://github.com/servo/angle", branch = "servo"}
rand = "0.3" # for the benchmarks
servo-glutin = "0.10.1" # for the example apps
servo-glutin = "0.11" # for the example apps

[target.'cfg(any(target_os = "android", all(unix, not(target_os = "macos"))))'.dependencies]
freetype = { version = "0.2", default-features = false }

[target.'cfg(target_os = "windows")'.dependencies]
dwrote = "0.3"
dwrote = "0.4"

[target.'cfg(target_os = "macos")'.dependencies]
core-graphics = "0.7.0"
core-text = "4.0"
core-graphics = "0.8.0"
core-text = "5.0"
4 changes: 2 additions & 2 deletions webrender/src/platform/macos/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct GlyphMetrics {
// this function from Skia which is used to check if a glyph
// can be rendered with subpixel AA.
fn supports_subpixel_aa() -> bool {
let mut cg_context = CGContext::create_bitmap_context(1, 1, 8, 4,
let mut cg_context = CGContext::create_bitmap_context(None, 1, 1, 8, 4,
&CGColorSpace::create_device_rgb(),
kCGImageAlphaNoneSkipFirst |
kCGBitmapByteOrder32Little);
Expand Down Expand Up @@ -285,7 +285,7 @@ impl FontContext {
FontRenderMode::Alpha | FontRenderMode::Mono => kCGImageAlphaPremultipliedLast,
};

let mut cg_context = CGContext::create_bitmap_context(metrics.rasterized_width as usize,
let mut cg_context = CGContext::create_bitmap_context(None, metrics.rasterized_width as usize,
metrics.rasterized_height as usize,
8,
metrics.rasterized_width as usize * 4,
Expand Down
17 changes: 8 additions & 9 deletions webrender_traits/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,20 @@ ipc = ["ipc-channel"]
webgl = ["offscreen_gl_context"]

[dependencies]
app_units = "0.4"
bincode = "1.0.0-alpha2"
app_units = "0.5"
bincode = "0.8"
byteorder = "1.0"
euclid = "0.14.4"
euclid = "0.15"
gleam = "0.4.5"
heapsize = ">= 0.3.6, < 0.5"
ipc-channel = {version = "0.7.2", optional = true}
offscreen_gl_context = {version = "0.9", features = ["serde"], optional = true}
serde = "0.9"
serde_derive = "0.9"
ipc-channel = {version = "0.8", optional = true}
offscreen_gl_context = {version = "0.11", features = ["serde"], optional = true}
serde = { version = "1.0", features = ["rc", "derive"] }
time = "0.1"

[target.'cfg(target_os = "macos")'.dependencies]
core-foundation = "0.3"
core-graphics = "0.7"
core-graphics = "0.8"

[target.'cfg(target_os = "windows")'.dependencies]
dwrote = "0.3"
dwrote = "0.4"
2 changes: 1 addition & 1 deletion webrender_traits/src/channel_ipc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl PayloadReceiverHelperMethods for PayloadReceiver {
}
}

pub fn msg_channel<T: Serialize + Deserialize>() -> Result<(MsgSender<T>, MsgReceiver<T>), Error> {
pub fn msg_channel<T: Serialize + for<'de> Deserialize<'de>>() -> Result<(MsgSender<T>, MsgReceiver<T>), Error> {
ipc::channel()
}

Expand Down
8 changes: 4 additions & 4 deletions webrender_traits/src/channel_mpsc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,16 @@ impl<T> Serialize for MsgSender<T> {
}
}

impl<T> Deserialize for MsgReceiver<T> {
impl<'de, T> Deserialize<'de> for MsgReceiver<T> {
fn deserialize<D>(_: D) -> Result<MsgReceiver<T>, D::Error>
where D: Deserializer {
where D: Deserializer<'de> {
unreachable!();
}
}

impl<T> Deserialize for MsgSender<T> {
impl<'de, T> Deserialize<'de> for MsgSender<T> {
fn deserialize<D>(_: D) -> Result<MsgSender<T>, D::Error>
where D: Deserializer {
where D: Deserializer<'de> {
unreachable!();
}
}
10 changes: 5 additions & 5 deletions webrender_traits/src/display_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl BuiltDisplayList {
BuiltDisplayListIter::new(self)
}

pub fn get<T: Deserialize>(&self, range: ItemRange<T>) -> AuxIter<T> {
pub fn get<'de, T: Deserialize<'de>>(&self, range: ItemRange<T>) -> AuxIter<T> {
AuxIter::new(&self.data[range.start .. range.start + range.length])
}
}
Expand Down Expand Up @@ -212,7 +212,7 @@ impl<'a> BuiltDisplayListIter<'a> {

/// Returns the byte-range the slice occupied, and the number of elements
/// in the slice.
fn skip_slice<T: Deserialize>(&mut self) -> (ItemRange<T>, usize) {
fn skip_slice<T: for<'de> Deserialize<'de>>(&mut self) -> (ItemRange<T>, usize) {
let base = self.list.data.as_ptr() as usize;
let start = self.data.as_ptr() as usize;

Expand Down Expand Up @@ -333,7 +333,7 @@ impl<'a, 'b> DisplayItemRef<'a, 'b> {
}
}

impl<'a, T: Deserialize> AuxIter<'a, T> {
impl<'de, 'a, T: Deserialize<'de>> AuxIter<'a, T> {
pub fn new(mut data: &'a [u8]) -> Self {

let size: usize = if data.len() == 0 {
Expand All @@ -351,7 +351,7 @@ impl<'a, T: Deserialize> AuxIter<'a, T> {
}
}

impl<'a, T: Deserialize> Iterator for AuxIter<'a, T> {
impl<'a, T: for<'de> Deserialize<'de>> Iterator for AuxIter<'a, T> {
type Item = T;

fn next(&mut self) -> Option<T> {
Expand All @@ -369,7 +369,7 @@ impl<'a, T: Deserialize> Iterator for AuxIter<'a, T> {
}
}

impl<'a, T: Deserialize> ::std::iter::ExactSizeIterator for AuxIter<'a, T> { }
impl<'a, T: for<'de> Deserialize<'de>> ::std::iter::ExactSizeIterator for AuxIter<'a, T> { }


// This is purely for the JSON writer in wrench
Expand Down
4 changes: 2 additions & 2 deletions webrender_traits/src/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ impl Serialize for NativeFontHandle {
}

#[cfg(target_os = "macos")]
impl Deserialize for NativeFontHandle {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: Deserializer {
impl<'de> Deserialize<'de> for NativeFontHandle {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: Deserializer<'de> {
let postscript_name: String = try!(Deserialize::deserialize(deserializer));

match CGFont::from_name(&CFString::new(&*postscript_name)) {
Expand Down
3 changes: 1 addition & 2 deletions webrender_traits/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ extern crate heapsize;
extern crate ipc_channel;
#[cfg(feature = "webgl")]
extern crate offscreen_gl_context;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde;
extern crate time;

#[cfg(target_os = "macos")]
Expand Down
4 changes: 2 additions & 2 deletions webrender_traits/src/webgl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ macro_rules! define_resource_id {
($name:ident) => {
define_resource_id_struct!($name);

impl ::serde::Deserialize for $name {
impl<'de> ::serde::Deserialize<'de> for $name {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: ::serde::Deserializer
where D: ::serde::Deserializer<'de>
{
let id = try!(u32::deserialize(deserializer));
if id == 0 {
Expand Down
17 changes: 8 additions & 9 deletions wrench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,32 @@ license = "MPL-2.0"

[dependencies]
base64 = "0.3"
bincode = "1.0.0-alpha2"
bincode = "0.8"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why from a 1.0 alpha to 0.8? Can someone explain to me what's going on with bincode's versioning? It's so confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know anything about bincode's versioning, but 0.8 is the only version supporting serde 1.0, that's why I chose it

byteorder = "1.0"
env_logger = { version = "0.4", optional = true }
euclid = "0.14.4"
euclid = "0.15"
gleam = "0.4"
servo-glutin = "0.10.1"
app_units = "0.4"
servo-glutin = "0.11"
app_units = "0.5"
image = "0.12"
clap = { version = "2", features = ["yaml"] }
lazy_static = "0.2"
yaml-rust = { git = "https://github.com/vvuk/yaml-rust", features = ["preserve_order"] }
serde_json = "0.9"
serde_json = "1.0"
time = "0.1"
crossbeam = "0.2"
osmesa-sys = { version = "0.1.2", optional = true }
osmesa-src = { git = "https://github.com/servo/osmesa-src", optional = true }
webrender = {path = "../webrender"}
webrender_traits = {path = "../webrender_traits"}
serde_derive = "0.9"
serde = "0.9"
serde = {version = "1.0", features = ["derive"] }

[features]
headless = [ "osmesa-sys", "osmesa-src" ]
logging = [ "env_logger" ]

[target.'cfg(target_os = "windows")'.dependencies]
dwrote = "0.3"
dwrote = "0.4"

[target.'cfg(any(target_os = "linux", target_os = "macos"))'.dependencies]
font-loader = "0.2.0"
font-loader = "0.3.0"
2 changes: 1 addition & 1 deletion wrench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ extern crate lazy_static;
#[cfg(feature = "headless")]
extern crate osmesa_sys;
#[macro_use]
extern crate serde_derive;
extern crate serde;
extern crate serde_json;
extern crate time;
extern crate webrender;
Expand Down