Skip to content

Commit c784ead

Browse files
committed
Some small changes to get Servo compiling
This was mostly a matter of missing traits. A similar change will also be pushed to the master branch.
1 parent 547b5c3 commit c784ead

4 files changed

Lines changed: 5 additions & 15 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "euclid"
3-
version = "0.8.0"
3+
version = "0.8.1"
44
authors = ["The Servo Project Developers"]
55
description = "Geometry primitives"
66
documentation = "http://doc.servo.org/euclid/"

src/length.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use std::ops::{AddAssign, SubAssign};
2020
use std::marker::PhantomData;
2121
use std::fmt;
2222

23-
#[derive(RustcDecodable, RustcEncodable)]
23+
#[derive(Clone, Copy, RustcDecodable, RustcEncodable)]
2424
pub struct UnknownUnit;
2525

2626
/// A one-dimensional distance, with value represented by `T` and unit of measurement `Unit`.
@@ -36,7 +36,7 @@ pub struct UnknownUnit;
3636
/// another. See the `ScaleFactor` docs for an example.
3737
// Uncomment the derive, and remove the macro call, once heapsize gets
3838
// PhantomData<T> support.
39-
#[derive(RustcDecodable, RustcEncodable)]
39+
#[derive(Clone, Copy, RustcDecodable, RustcEncodable)]
4040
pub struct Length<T, Unit>(pub T, PhantomData<Unit>);
4141

4242
impl<Unit, T: HeapSizeOf> HeapSizeOf for Length<T, Unit> {
@@ -64,8 +64,6 @@ impl<T, Unit> Length<T, Unit> {
6464
}
6565
}
6666

67-
impl<T: Copy, Unit> Copy for Length<T, Unit> {}
68-
6967
impl<Unit, T: Clone> Length<T, Unit> {
7068
pub fn get(&self) -> T {
7169
self.0.clone()
@@ -157,15 +155,6 @@ impl<Unit, T0: NumCast + Clone> Length<T0, Unit> {
157155
}
158156
}
159157

160-
// FIXME: Switch to `derive(Clone, PartialEq, PartialOrd, Zero)` after this Rust issue is fixed:
161-
// https://github.com/mozilla/rust/issues/7671
162-
163-
impl<Unit, T: Clone> Clone for Length<T, Unit> {
164-
fn clone(&self) -> Length<T, Unit> {
165-
Length::new(self.get())
166-
}
167-
}
168-
169158
impl<Unit, T: Clone + PartialEq> PartialEq for Length<T, Unit> {
170159
fn eq(&self, other: &Length<T, Unit>) -> bool { self.get().eq(&other.get()) }
171160
}

src/matrix2d.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use std::ops::{Add, Mul, Sub};
1616
use std::marker::PhantomData;
1717

1818
define_matrix! {
19+
#[derive(Clone, Copy, Eq, Hash, PartialEq)]
1920
pub struct TypedMatrix2D<T, Src, Dst> {
2021
pub m11: T, pub m12: T,
2122
pub m21: T, pub m22: T,

src/side_offsets.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use heapsize::HeapSizeOf;
2121
/// A group of side offsets, which correspond to top/left/bottom/right for borders, padding,
2222
/// and margins in CSS.
2323
define_vector! {
24-
#[derive(Debug)]
24+
#[derive(Clone, Debug)]
2525
pub struct TypedSideOffsets2D<T, U> {
2626
pub top: T,
2727
pub right: T,

0 commit comments

Comments
 (0)