mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Upgrade to rustc ba2f13ef0 2015-02-04
This commit is contained in:
parent
bc6882bdef
commit
d5dd1d658e
136 changed files with 1091 additions and 878 deletions
|
@ -36,7 +36,12 @@ git = "https://github.com/servo/string-cache"
|
|||
[dependencies.string_cache_macros]
|
||||
git = "https://github.com/servo/string-cache"
|
||||
|
||||
[dependencies.lazy_static]
|
||||
git = "https://github.com/Kimundi/lazy-static.rs"
|
||||
|
||||
[dependencies]
|
||||
text_writer = "0.1.1"
|
||||
url = "0.2.16"
|
||||
time = "0.1.12"
|
||||
time = "0.1.12"
|
||||
bitflags = "*"
|
||||
rand = "*"
|
||||
|
|
|
@ -10,7 +10,7 @@ use std::collections::hash_state::DefaultState;
|
|||
use rand::Rng;
|
||||
use std::hash::{Hash, Hasher, SipHasher};
|
||||
use std::iter::repeat;
|
||||
use std::rand;
|
||||
use rand;
|
||||
use std::slice::Iter;
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -10,7 +10,7 @@ use text_writer::TextWriter;
|
|||
|
||||
macro_rules! define_cursor {
|
||||
($( $css: expr => $variant: ident = $value: expr, )+) => {
|
||||
#[derive(Clone, Copy, PartialEq, Eq, FromPrimitive, Show)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, FromPrimitive, Debug)]
|
||||
#[repr(u8)]
|
||||
pub enum Cursor {
|
||||
$( $variant = $value ),+
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
* 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/. */
|
||||
|
||||
use std::io;
|
||||
use std::io::Writer;
|
||||
use std::old_io as io;
|
||||
use std::old_io::Writer;
|
||||
use std::mem;
|
||||
use std::mem::size_of;
|
||||
use std::slice;
|
||||
|
|
|
@ -86,19 +86,21 @@ struct Deque<T> {
|
|||
/// There may only be one worker per deque.
|
||||
pub struct Worker<T> {
|
||||
deque: Arc<Deque<T>>,
|
||||
_noshare: marker::NoSync,
|
||||
}
|
||||
|
||||
impl<T> !marker::Sync for Worker<T> {}
|
||||
|
||||
/// The stealing half of the work-stealing deque. Stealers have access to the
|
||||
/// opposite end of the deque from the worker, and they only have access to the
|
||||
/// `steal` method.
|
||||
pub struct Stealer<T> {
|
||||
deque: Arc<Deque<T>>,
|
||||
_noshare: marker::NoSync,
|
||||
}
|
||||
|
||||
impl<T> !marker::Sync for Stealer<T> {}
|
||||
|
||||
/// When stealing some data, this is an enumeration of the possible outcomes.
|
||||
#[derive(PartialEq, Show)]
|
||||
#[derive(PartialEq, Debug)]
|
||||
pub enum Stolen<T> {
|
||||
/// The deque was empty at the time of stealing
|
||||
Empty,
|
||||
|
@ -156,8 +158,7 @@ impl<T: Send> BufferPool<T> {
|
|||
pub fn deque(&self) -> (Worker<T>, Stealer<T>) {
|
||||
let a = Arc::new(Deque::new(self.clone()));
|
||||
let b = a.clone();
|
||||
(Worker { deque: a, _noshare: marker::NoSync },
|
||||
Stealer { deque: b, _noshare: marker::NoSync })
|
||||
(Worker { deque: a }, Stealer { deque: b })
|
||||
}
|
||||
|
||||
fn alloc(&mut self, bits: uint) -> Box<Buffer<T>> {
|
||||
|
@ -218,7 +219,7 @@ impl<T: Send> Stealer<T> {
|
|||
|
||||
impl<T: Send> Clone for Stealer<T> {
|
||||
fn clone(&self) -> Stealer<T> {
|
||||
Stealer { deque: self.deque.clone(), _noshare: marker::NoSync }
|
||||
Stealer { deque: self.deque.clone() }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ use rustc_serialize::{Encoder, Encodable};
|
|||
///
|
||||
/// The ratio between ScreenPx and DevicePixel for a given display be found by calling
|
||||
/// `servo::windowing::WindowMethods::hidpi_factor`.
|
||||
#[derive(Show, Copy)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub enum ScreenPx {}
|
||||
|
||||
/// One CSS "px" in the coordinate system of the "initial viewport":
|
||||
|
@ -43,7 +43,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(RustcEncodable, Show, Copy)]
|
||||
#[derive(RustcEncodable, Debug, Copy)]
|
||||
pub enum ViewportPx {}
|
||||
|
||||
/// One CSS "px" in the root coordinate system for the content document.
|
||||
|
@ -52,7 +52,7 @@ 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(RustcEncodable, Show, Copy)]
|
||||
#[derive(RustcEncodable, Debug, Copy)]
|
||||
pub enum PagePx {}
|
||||
|
||||
// In summary, the hierarchy of pixel units and the factors to convert from one to the next:
|
||||
|
@ -120,7 +120,7 @@ impl Encodable for Au {
|
|||
}
|
||||
}
|
||||
|
||||
impl fmt::Show for Au {
|
||||
impl fmt::Debug for Au {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{}px", to_frac_px(*self))
|
||||
}}
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
#![feature(plugin)]
|
||||
#![feature(int_uint)]
|
||||
#![feature(box_syntax)]
|
||||
#![feature(optin_builtin_traits)]
|
||||
#![feature(core, rustc_private, hash, alloc)]
|
||||
#![feature(collections, libc, std_misc)]
|
||||
|
||||
#![allow(missing_copy_implementations)]
|
||||
#![allow(unstable)]
|
||||
|
@ -13,6 +16,7 @@
|
|||
#[macro_use] extern crate log;
|
||||
|
||||
extern crate alloc;
|
||||
#[macro_use] extern crate bitflags;
|
||||
extern crate collections;
|
||||
extern crate cssparser;
|
||||
extern crate geom;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
use geom::{Size2D, Point2D, SideOffsets2D, Rect};
|
||||
use geom::num::Zero;
|
||||
use std::cmp::{min, max};
|
||||
use std::fmt::{Show, Formatter, Error};
|
||||
use std::fmt::{Debug, Formatter, Error};
|
||||
use std::ops::{Add, Sub};
|
||||
|
||||
bitflags!(
|
||||
|
@ -49,7 +49,7 @@ impl WritingMode {
|
|||
}
|
||||
}
|
||||
|
||||
impl Show for WritingMode {
|
||||
impl Debug for WritingMode {
|
||||
fn fmt(&self, formatter: &mut Formatter) -> Result<(), Error> {
|
||||
if self.is_vertical() {
|
||||
try!(write!(formatter, "V"));
|
||||
|
@ -121,7 +121,7 @@ impl DebugWritingMode {
|
|||
}
|
||||
}
|
||||
|
||||
impl Show for DebugWritingMode {
|
||||
impl Debug for DebugWritingMode {
|
||||
#[cfg(ndebug)]
|
||||
fn fmt(&self, formatter: &mut Formatter) -> Result<(), Error> {
|
||||
write!(formatter, "?")
|
||||
|
@ -142,7 +142,7 @@ pub struct LogicalSize<T> {
|
|||
debug_writing_mode: DebugWritingMode,
|
||||
}
|
||||
|
||||
impl<T: Show> Show for LogicalSize<T> {
|
||||
impl<T: Debug> Debug for LogicalSize<T> {
|
||||
fn fmt(&self, formatter: &mut Formatter) -> Result<(), Error> {
|
||||
write!(formatter, "LogicalSize({:?}, i{:?}×b{:?})",
|
||||
self.debug_writing_mode, self.inline, self.block)
|
||||
|
@ -278,7 +278,7 @@ pub struct LogicalPoint<T> {
|
|||
debug_writing_mode: DebugWritingMode,
|
||||
}
|
||||
|
||||
impl<T: Show> Show for LogicalPoint<T> {
|
||||
impl<T: Debug> Debug for LogicalPoint<T> {
|
||||
fn fmt(&self, formatter: &mut Formatter) -> Result<(), Error> {
|
||||
write!(formatter, "LogicalPoint({:?} (i{:?}, b{:?}))",
|
||||
self.debug_writing_mode, self.i, self.b)
|
||||
|
@ -452,7 +452,7 @@ pub struct LogicalMargin<T> {
|
|||
debug_writing_mode: DebugWritingMode,
|
||||
}
|
||||
|
||||
impl<T: Show> Show for LogicalMargin<T> {
|
||||
impl<T: Debug> Debug for LogicalMargin<T> {
|
||||
fn fmt(&self, formatter: &mut Formatter) -> Result<(), Error> {
|
||||
write!(formatter,
|
||||
"LogicalMargin({:?}, inline: {:?}..{:?} block: {:?}..{:?})",
|
||||
|
@ -738,7 +738,7 @@ pub struct LogicalRect<T> {
|
|||
debug_writing_mode: DebugWritingMode,
|
||||
}
|
||||
|
||||
impl<T: Show> Show for LogicalRect<T> {
|
||||
impl<T: Debug> Debug for LogicalRect<T> {
|
||||
fn fmt(&self, formatter: &mut Formatter) -> Result<(), Error> {
|
||||
write!(formatter,
|
||||
"LogicalRect({:?}, i{:?}×b{:?}, @ (i{:?},b{:?}))",
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
use libc::{c_char,c_int,c_void,size_t};
|
||||
use std::borrow::ToOwned;
|
||||
use std::ffi::CString;
|
||||
use std::io::timer::sleep;
|
||||
use std::old_io::timer::sleep;
|
||||
#[cfg(target_os="linux")]
|
||||
use std::io::File;
|
||||
use std::old_io::File;
|
||||
use std::mem;
|
||||
use std::mem::size_of;
|
||||
#[cfg(target_os="linux")]
|
||||
|
@ -222,7 +222,7 @@ fn get_proc_self_statm_field(field: uint) -> Option<u64> {
|
|||
match f.read_to_string() {
|
||||
Ok(contents) => {
|
||||
let s = option_try!(contents.as_slice().words().nth(field));
|
||||
let npages: u64 = option_try!(s.parse());
|
||||
let npages: u64 = option_try!(s.parse().ok());
|
||||
Some(npages * (page_size() as u64))
|
||||
}
|
||||
Err(_) => None
|
||||
|
|
|
@ -13,7 +13,7 @@ use layers::geometry::DevicePixel;
|
|||
use getopts;
|
||||
use std::collections::HashSet;
|
||||
use std::cmp;
|
||||
use std::io;
|
||||
use std::old_io as io;
|
||||
use std::mem;
|
||||
use std::os;
|
||||
use std::ptr;
|
||||
|
@ -219,11 +219,11 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
|
|||
return false;
|
||||
};
|
||||
|
||||
let mut debug_options = HashSet::new();
|
||||
let debug_string = match opt_match.opt_str("Z") {
|
||||
Some(string) => string,
|
||||
None => String::new()
|
||||
};
|
||||
let mut debug_options = HashSet::new();
|
||||
for split in debug_string.as_slice().split(',') {
|
||||
debug_options.insert(split.clone());
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ use std::num;
|
|||
use std::num::Int;
|
||||
|
||||
/// An index type to be used by a `Range`
|
||||
pub trait RangeIndex: Int + fmt::Show {
|
||||
pub trait RangeIndex: Int + fmt::Debug {
|
||||
type Index;
|
||||
fn new(x: Self::Index) -> Self;
|
||||
fn get(self) -> Self::Index;
|
||||
|
@ -28,7 +28,7 @@ impl RangeIndex for int {
|
|||
#[macro_export]
|
||||
macro_rules! int_range_index {
|
||||
($(#[$attr:meta])* struct $Self:ident($T:ty)) => (
|
||||
#[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Show, Copy)]
|
||||
#[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Debug, Copy)]
|
||||
$(#[$attr])*
|
||||
pub struct $Self(pub $T);
|
||||
|
||||
|
@ -194,7 +194,7 @@ pub struct Range<I> {
|
|||
length: I,
|
||||
}
|
||||
|
||||
impl<I: RangeIndex> fmt::Show for Range<I> {
|
||||
impl<I: RangeIndex> fmt::Debug for Range<I> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "[{:?} .. {:?})", self.begin(), self.end())
|
||||
}
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
* 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/. */
|
||||
|
||||
use std::io::{File, IoResult};
|
||||
use std::path::Path;
|
||||
use std::old_io::{File, IoResult};
|
||||
use std::old_path::Path;
|
||||
|
||||
#[cfg(not(target_os = "android"))]
|
||||
use opts;
|
||||
|
||||
#[cfg(not(target_os = "android"))]
|
||||
use std::io::fs::PathExtensions;
|
||||
use std::old_io::fs::PathExtensions;
|
||||
#[cfg(not(target_os = "android"))]
|
||||
use std::os;
|
||||
|
||||
|
|
|
@ -325,7 +325,7 @@ impl<'a, T: 'a> Iterator for SmallVecMoveIterator<'a,T> {
|
|||
impl<'a, T: 'a> Drop for SmallVecMoveIterator<'a,T> {
|
||||
fn drop(&mut self) {
|
||||
// Destroy the remaining elements.
|
||||
for _ in *self {}
|
||||
for _ in self.by_ref() {}
|
||||
|
||||
match self.allocation {
|
||||
None => {}
|
||||
|
@ -443,7 +443,7 @@ macro_rules! def_small_vector(
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: fmt::Show> fmt::Show for $name<T> {
|
||||
impl<T: fmt::Debug> fmt::Debug for $name<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{:?}", self.as_slice())
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ pub static HTML_SPACE_CHARACTERS: StaticCharVec = &[
|
|||
];
|
||||
|
||||
pub fn split_html_space_chars<'a>(s: &'a str) ->
|
||||
Filter<&'a str, Split<'a, StaticCharVec>, fn(&&str) -> bool> {
|
||||
Filter<Split<'a, StaticCharVec>, fn(&&str) -> bool> {
|
||||
fn not_empty(&split: &&str) -> bool { !split.is_empty() }
|
||||
s.split(HTML_SPACE_CHARACTERS).filter(not_empty as fn(&&str) -> bool)
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ pub fn parse_length(mut value: &str) -> LengthOrPercentageOrAuto {
|
|||
return LengthOrPercentageOrAuto::Auto
|
||||
}
|
||||
if value.starts_with("+") {
|
||||
value = value.slice_from(1)
|
||||
value = &value[1..]
|
||||
}
|
||||
value = value.trim_left_matches('0');
|
||||
if value.len() == 0 {
|
||||
|
@ -176,19 +176,19 @@ pub fn parse_length(mut value: &str) -> LengthOrPercentageOrAuto {
|
|||
}
|
||||
}
|
||||
}
|
||||
value = value.slice_to(end_index);
|
||||
value = &value[..end_index];
|
||||
|
||||
if found_percent {
|
||||
let result: Option<f64> = FromStr::from_str(value);
|
||||
let result: Result<f64, _> = FromStr::from_str(value);
|
||||
match result {
|
||||
Some(number) => return LengthOrPercentageOrAuto::Percentage((number as f64) / 100.0),
|
||||
None => return LengthOrPercentageOrAuto::Auto,
|
||||
Ok(number) => return LengthOrPercentageOrAuto::Percentage((number as f64) / 100.0),
|
||||
Err(_) => return LengthOrPercentageOrAuto::Auto,
|
||||
}
|
||||
}
|
||||
|
||||
match FromStr::from_str(value) {
|
||||
Some(number) => LengthOrPercentageOrAuto::Length(Au::from_px(number)),
|
||||
None => LengthOrPercentageOrAuto::Auto,
|
||||
Ok(number) => LengthOrPercentageOrAuto::Length(Au::from_px(number)),
|
||||
Err(_) => LengthOrPercentageOrAuto::Auto,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -245,14 +245,14 @@ pub fn parse_legacy_color(mut input: &str) -> Result<RGBA,()> {
|
|||
// Step 8.
|
||||
for (char_count, (index, _)) in input.char_indices().enumerate() {
|
||||
if char_count == 128 {
|
||||
input = input.slice_to(index);
|
||||
input = &input[..index];
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// Step 9.
|
||||
if input.char_at(0) == '#' {
|
||||
input = input.slice_from(1)
|
||||
input = &input[1..]
|
||||
}
|
||||
|
||||
// Step 10.
|
||||
|
@ -274,22 +274,22 @@ pub fn parse_legacy_color(mut input: &str) -> Result<RGBA,()> {
|
|||
// Step 12.
|
||||
let mut length = input.len() / 3;
|
||||
let (mut red, mut green, mut blue) = (input.slice_to(length),
|
||||
input.slice(length, length * 2),
|
||||
input.slice_from(length * 2));
|
||||
&input[length..length * 2],
|
||||
&input[length * 2..]);
|
||||
|
||||
// Step 13.
|
||||
if length > 8 {
|
||||
red = red.slice_from(length - 8);
|
||||
green = green.slice_from(length - 8);
|
||||
blue = blue.slice_from(length - 8);
|
||||
red = &red[length - 8..];
|
||||
green = &green[length - 8..];
|
||||
blue = &blue[length - 8..];
|
||||
length = 8
|
||||
}
|
||||
|
||||
// Step 14.
|
||||
while length > 2 && red[0] == b'0' && green[0] == b'0' && blue[0] == b'0' {
|
||||
red = red.slice_from(1);
|
||||
green = green.slice_from(1);
|
||||
blue = blue.slice_from(1);
|
||||
red = &red[1..];
|
||||
green = &green[1..];
|
||||
blue = &blue[1..];
|
||||
length -= 1
|
||||
}
|
||||
|
||||
|
@ -324,7 +324,7 @@ pub fn parse_legacy_color(mut input: &str) -> Result<RGBA,()> {
|
|||
}
|
||||
|
||||
|
||||
#[derive(Clone, Eq, PartialEq, Hash, Show)]
|
||||
#[derive(Clone, Eq, PartialEq, Hash, Debug)]
|
||||
pub struct LowercaseString {
|
||||
inner: String,
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
pub use self::imp::{initialize, get, enter, exit};
|
||||
|
||||
bitflags! {
|
||||
#[derive(Show)]
|
||||
#[derive(Debug)]
|
||||
flags TaskState: u32 {
|
||||
const SCRIPT = 0x01,
|
||||
const LAYOUT = 0x02,
|
||||
|
|
|
@ -8,7 +8,7 @@ use collections::BTreeMap;
|
|||
use std::borrow::ToOwned;
|
||||
use std::cmp::Ordering;
|
||||
use std::f64;
|
||||
use std::io::timer::sleep;
|
||||
use std::old_io::timer::sleep;
|
||||
use std::iter::AdditiveIterator;
|
||||
use std::num::Float;
|
||||
use std::sync::mpsc::{Sender, channel, Receiver};
|
||||
|
@ -46,7 +46,7 @@ impl Formatable for Option<TimerMetadata> {
|
|||
&Some(ref meta) => {
|
||||
let url = meta.url.as_slice();
|
||||
let url = if url.len() > 30 {
|
||||
url.slice_to(30)
|
||||
&url[..30]
|
||||
} else {
|
||||
url
|
||||
};
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
use std::cmp::{PartialOrd, PartialEq, Ordering};
|
||||
|
||||
#[cfg(test)]
|
||||
use std::fmt::Show;
|
||||
use std::fmt::Debug;
|
||||
|
||||
/// FIXME(pcwalton): Workaround for lack of unboxed closures. This is called in
|
||||
/// performance-critical code, so a closure is insufficient.
|
||||
|
@ -74,7 +74,7 @@ fn test_find_all_elems<T: PartialEq + PartialOrd + Eq + Ord>(arr: &[T]) {
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn test_miss_all_elems<T: PartialEq + PartialOrd + Eq + Ord + Show>(arr: &[T], misses: &[T]) {
|
||||
fn test_miss_all_elems<T: PartialEq + PartialOrd + Eq + Ord + Debug>(arr: &[T], misses: &[T]) {
|
||||
let mut i = 0;
|
||||
while i < misses.len() {
|
||||
let res = arr.binary_search_(&misses[i]);
|
||||
|
|
|
@ -11,9 +11,8 @@ use task::spawn_named;
|
|||
use task_state;
|
||||
|
||||
use libc::funcs::posix88::unistd::usleep;
|
||||
use rand::{Rng, XorShiftRng};
|
||||
use std::mem;
|
||||
use std::rand::weak_rng;
|
||||
use rand::{Rng, weak_rng, XorShiftRng};
|
||||
use std::sync::atomic::{AtomicUint, Ordering};
|
||||
use std::sync::mpsc::{channel, Sender, Receiver};
|
||||
use deque::{Abort, BufferPool, Data, Empty, Stealer, Worker};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue