Upgrade to rustc ba2f13ef0 2015-02-04

This commit is contained in:
Simon Sapin 2015-01-31 14:36:05 +01:00 committed by Matt Brubeck
parent bc6882bdef
commit d5dd1d658e
136 changed files with 1091 additions and 878 deletions

View file

@ -3,7 +3,7 @@ name = "script"
version = "0.0.1"
authors = ["The Servo Project Developers"]
build = "make -f makefile.cargo"
build = "build.rs"
[lib]
name = "script"
@ -50,7 +50,7 @@ git = "https://github.com/servo/html5ever"
[dependencies.hyper]
git = "https://github.com/servo/hyper"
branch = "old_servo_new_cookies"
branch = "servo"
[dependencies.js]
git = "https://github.com/servo/rust-mozjs"
@ -68,3 +68,5 @@ git = "https://github.com/servo/string-cache"
encoding = "0.2"
url = "0.2.16"
time = "0.1.12"
bitflags = "*"
rustc-serialize = "*"

View file

@ -0,0 +1,18 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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(io)]
use std::old_io::process::{Command, ProcessExit, StdioContainer};
fn main() {
let result = Command::new("make")
.args(&["-f", "makefile.cargo"])
.stdout(StdioContainer::InheritFd(1))
.stderr(StdioContainer::InheritFd(2))
.status()
.unwrap();
assert_eq!(result, ProcessExit::ExitStatus(0));
}

View file

@ -10,16 +10,16 @@
//! with CORSRequest being expanded into FetchRequest (etc)
use std::ascii::AsciiExt;
use std::fmt::{self, Show};
use std::fmt::{self, Display};
use std::str::from_utf8;
use time;
use time::{now, Timespec};
use hyper::header::{Headers, Header, HeaderFormat, HeaderView};
use hyper::header::shared::util as header_util;
use hyper::header::parsing as header_parsing;
use hyper::client::Request;
use hyper::mime::{Mime, TopLevel, SubLevel};
use hyper::header::common::{ContentType, Host};
use hyper::header::{ContentType, Host};
use hyper::method::Method;
use hyper::status::StatusClass::Success;
@ -160,6 +160,7 @@ impl CORSRequest {
}
cors_response.headers = response.headers.clone();
// Substeps 1-3 (parsing rules: http://fetch.spec.whatwg.org/#http-new-header-syntax)
let methods_substep4 = [self.method.clone()];
let mut methods = match response.headers.get() {
Some(&AccessControlAllowMethods(ref v)) => v.as_slice(),
_ => return error
@ -169,7 +170,6 @@ impl CORSRequest {
_ => return error
};
// Substep 4
let methods_substep4 = [self.method.clone()];
if methods.len() == 0 || preflight.mode == RequestMode::ForcedPreflight {
methods = methods_substep4.as_slice();
}
@ -388,19 +388,19 @@ struct AccessControlRequestMethod(pub Method);
impl Header for AccessControlRequestMethod {
#[inline]
fn header_name(_: Option<AccessControlRequestMethod>) -> &'static str {
fn header_name() -> &'static str {
"Access-Control-Request-Method"
}
fn parse_header(raw: &[Vec<u8>]) -> Option<AccessControlRequestMethod> {
header_util::from_one_raw_str(raw).map(AccessControlRequestMethod)
header_parsing::from_one_raw_str(raw).map(AccessControlRequestMethod)
}
}
impl HeaderFormat for AccessControlRequestMethod {
fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
let AccessControlRequestMethod(ref method) = *self;
method.fmt(f)
<_ as Display>::fmt(method, f)
}
}
@ -409,19 +409,19 @@ struct AccessControlRequestHeaders(pub Vec<String>);
impl Header for AccessControlRequestHeaders {
#[inline]
fn header_name(_: Option<AccessControlRequestHeaders>) -> &'static str {
fn header_name() -> &'static str {
"Access-Control-Request-Headers"
}
fn parse_header(raw: &[Vec<u8>]) -> Option<AccessControlRequestHeaders> {
header_util::from_comma_delimited(raw).map(AccessControlRequestHeaders)
header_parsing::from_comma_delimited(raw).map(AccessControlRequestHeaders)
}
}
impl HeaderFormat for AccessControlRequestHeaders {
fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
let AccessControlRequestHeaders(ref parts) = *self;
header_util::fmt_comma_delimited(f, parts.as_slice())
header_parsing::fmt_comma_delimited(f, parts.as_slice())
}
}
@ -430,19 +430,19 @@ struct AccessControlAllowMethods(pub Vec<Method>);
impl Header for AccessControlAllowMethods {
#[inline]
fn header_name(_: Option<AccessControlAllowMethods>) -> &'static str {
fn header_name() -> &'static str {
"Access-Control-Allow-Methods"
}
fn parse_header(raw: &[Vec<u8>]) -> Option<AccessControlAllowMethods> {
header_util::from_comma_delimited(raw).map(AccessControlAllowMethods)
header_parsing::from_comma_delimited(raw).map(AccessControlAllowMethods)
}
}
impl HeaderFormat for AccessControlAllowMethods {
fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
let AccessControlAllowMethods(ref parts) = *self;
header_util::fmt_comma_delimited(f, parts.as_slice())
header_parsing::fmt_comma_delimited(f, parts.as_slice())
}
}
@ -451,19 +451,19 @@ struct AccessControlAllowHeaders(pub Vec<String>);
impl Header for AccessControlAllowHeaders {
#[inline]
fn header_name(_: Option<AccessControlAllowHeaders>) -> &'static str {
fn header_name() -> &'static str {
"Access-Control-Allow-Headers"
}
fn parse_header(raw: &[Vec<u8>]) -> Option<AccessControlAllowHeaders> {
header_util::from_comma_delimited(raw).map(AccessControlAllowHeaders)
header_parsing::from_comma_delimited(raw).map(AccessControlAllowHeaders)
}
}
impl HeaderFormat for AccessControlAllowHeaders {
fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
let AccessControlAllowHeaders(ref parts) = *self;
header_util::fmt_comma_delimited(f, parts.as_slice())
header_parsing::fmt_comma_delimited(f, parts.as_slice())
}
}
@ -476,7 +476,7 @@ enum AccessControlAllowOrigin {
impl Header for AccessControlAllowOrigin {
#[inline]
fn header_name(_: Option<AccessControlAllowOrigin>) -> &'static str {
fn header_name() -> &'static str {
"Access-Control-Allow-Origin"
}
@ -498,8 +498,8 @@ impl Header for AccessControlAllowOrigin {
impl HeaderFormat for AccessControlAllowOrigin {
fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
AccessControlAllowOrigin::AllowStar => "*".fmt(f),
AccessControlAllowOrigin::AllowOrigin(ref url) => url.fmt(f)
AccessControlAllowOrigin::AllowStar => <_ as Display>::fmt("*", f),
AccessControlAllowOrigin::AllowOrigin(ref url) => <_ as Display>::fmt(url, f)
}
}
}
@ -509,19 +509,19 @@ struct AccessControlMaxAge(pub u32);
impl Header for AccessControlMaxAge {
#[inline]
fn header_name(_: Option<AccessControlMaxAge>) -> &'static str {
fn header_name() -> &'static str {
"Access-Control-Max-Age"
}
fn parse_header(raw: &[Vec<u8>]) -> Option<AccessControlMaxAge> {
header_util::from_one_raw_str(raw).map(AccessControlMaxAge)
header_parsing::from_one_raw_str(raw).map(AccessControlMaxAge)
}
}
impl HeaderFormat for AccessControlMaxAge {
fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
let AccessControlMaxAge(ref num) = *self;
num.fmt(f)
<_ as Display>::fmt(num, f)
}
}

View file

@ -20,7 +20,7 @@ use std::ffi::CString;
use std::ptr;
/// DOM exceptions that can be thrown by a native DOM method.
#[derive(Show, Clone)]
#[derive(Debug, Clone)]
pub enum Error {
/// IndexSizeError
IndexSize,

View file

@ -152,7 +152,8 @@ impl Hash<SipHasher> for ByteString {
}
impl FromStr for ByteString {
fn from_str(s: &str) -> Option<ByteString> {
Some(ByteString::new(s.to_owned().into_bytes()))
type Err = ();
fn from_str(s: &str) -> Result<ByteString, ()> {
Ok(ByteString::new(s.to_owned().into_bytes()))
}
}

View file

@ -57,7 +57,7 @@ use std::collections::HashMap;
use std::collections::hash_state::HashState;
use std::ffi::CString;
use std::hash::{Hash, Hasher};
use std::io::timer::Timer;
use std::old_io::timer::Timer;
use std::rc::Rc;
use std::sync::mpsc::{Receiver, Sender};
use string_cache::{Atom, Namespace};

View file

@ -14,7 +14,7 @@ use util::str::DOMString;
use std::borrow::ToOwned;
#[repr(uint)]
#[derive(Copy, Show)]
#[derive(Copy, Debug)]
#[jstraceable]
pub enum DOMErrorName {
IndexSizeError = DOMExceptionConstants::INDEX_SIZE_ERR as uint,

View file

@ -92,7 +92,7 @@ impl ElementDerived for EventTarget {
}
}
#[derive(Copy, PartialEq, Show)]
#[derive(Copy, PartialEq, Debug)]
#[jstraceable]
pub enum ElementTypeId {
HTMLElement(HTMLElementTypeId),
@ -1404,8 +1404,8 @@ impl<'a> style::node::TElement<'a> for JSRef<'a, Element> {
has_class(self, name)
}
fn each_class<F>(self, callback: F)
where F: Fn(&Atom)
fn each_class<F>(self, mut callback: F)
where F: FnMut(&Atom)
{
match self.get_attribute(ns!(""), &atom!("class")).root() {
None => {}

View file

@ -165,9 +165,7 @@ impl HTMLCollection {
}
fn traverse<'a>(root: JSRef<'a, Node>)
-> FilterMap<JSRef<'a, Node>,
JSRef<'a, Element>,
Skip<TreeIterator<'a>>,
-> FilterMap<Skip<TreeIterator<'a>>,
fn(JSRef<Node>) -> Option<JSRef<Element>>> {
root.traverse_preorder()
.skip(1)

View file

@ -206,7 +206,7 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLElement> {
}
}
#[derive(Copy, PartialEq, Show)]
#[derive(Copy, PartialEq, Debug)]
#[jstraceable]
pub enum HTMLElementTypeId {
HTMLElement,

View file

@ -23,7 +23,7 @@ use dom::htmlbuttonelement::{HTMLButtonElement};
use dom::htmltextareaelement::{HTMLTextAreaElement, HTMLTextAreaElementHelpers};
use dom::node::{Node, NodeHelpers, NodeTypeId, document_from_node, window_from_node};
use hyper::method::Method;
use hyper::header::common::ContentType;
use hyper::header::ContentType;
use hyper::mime;
use msg::constellation_msg::LoadData;
use util::str::DOMString;

View file

@ -38,7 +38,7 @@ impl HTMLMediaElement {
}
}
#[derive(Copy, PartialEq, Show)]
#[derive(Copy, PartialEq, Debug)]
#[jstraceable]
pub enum HTMLMediaElementTypeId {
HTMLAudioElement,

View file

@ -22,7 +22,7 @@ pub fn serialize(iterator: &mut NodeIterator) -> String {
let mut html = String::new();
let mut open_elements: Vec<String> = vec!();
let depth = iterator.depth;
for node in *iterator {
for node in iterator {
while open_elements.len() > depth {
html.push_str("</");
html.push_str(open_elements.pop().unwrap().as_slice());

View file

@ -16,7 +16,7 @@ use cssparser::RGBA;
use util::str::{self, DOMString, LengthOrPercentageOrAuto};
use std::cell::Cell;
#[derive(Copy, PartialEq, Show)]
#[derive(Copy, PartialEq, Debug)]
#[jstraceable]
pub enum HTMLTableCellElementTypeId {
HTMLTableDataCellElement,

View file

@ -261,7 +261,7 @@ impl LayoutDataRef {
unsafe impl Send for LayoutDataRef {}
/// The different types of nodes.
#[derive(Copy, PartialEq, Show)]
#[derive(Copy, PartialEq, Debug)]
#[jstraceable]
pub enum NodeTypeId {
DocumentType,
@ -1020,10 +1020,7 @@ impl RawLayoutNodeHelpers for Node {
//
pub type ChildElementIterator<'a> =
Peekable<JSRef<'a, Element>,
FilterMap<JSRef<'a, Node>,
JSRef<'a, Element>,
NodeChildrenIterator<'a>,
Peekable<FilterMap<NodeChildrenIterator<'a>,
fn(JSRef<Node>) -> Option<JSRef<Element>>>>;
pub struct NodeChildrenIterator<'a> {

View file

@ -92,7 +92,8 @@ struct Tracer {
trc: *mut JSTracer,
}
impl tree_builder::Tracer<JS<Node>> for Tracer {
impl tree_builder::Tracer for Tracer {
type Handle = JS<Node>;
#[allow(unrooted_must_root)]
fn trace_handle(&self, node: JS<Node>) {
node.trace(self.trc);
@ -107,7 +108,7 @@ impl JSTraceable for ServoHTMLParser {
let tracer = Tracer {
trc: trc,
};
let tracer = &tracer as &tree_builder::Tracer<JS<Node>>;
let tracer = &tracer as &tree_builder::Tracer<Handle=JS<Node>>;
unsafe {
// Assertion: If the parser is mutably borrowed, we're in the

View file

@ -47,7 +47,7 @@ use js::rust::with_compartment;
use url::{Url, UrlParser};
use libc;
use rustc_serialize::base64::{FromBase64, ToBase64, STANDARD};
use serialize::base64::{FromBase64, ToBase64, STANDARD};
use std::cell::{Ref, RefMut};
use std::default::Default;
use std::ffi::CString;
@ -140,7 +140,7 @@ pub fn base64_btoa(btoa: DOMString) -> Fallible<DOMString> {
// http://www.whatwg.org/html/#atob
pub fn base64_atob(atob: DOMString) -> Fallible<DOMString> {
// "Let input be the string being parsed."
let mut input = atob.as_slice();
let input = atob.as_slice();
// "Remove all space characters from input."
// serialize::base64::from_base64 ignores \r and \n,
@ -152,7 +152,7 @@ pub fn base64_atob(atob: DOMString) -> Fallible<DOMString> {
let without_spaces = input.chars()
.filter(|&c| ! is_html_space(c))
.collect::<String>();
input = without_spaces.as_slice();
let mut input = without_spaces.as_slice();
// "If the length of input divides by 4 leaving no remainder, then:
// if input ends with one or two U+003D EQUALS SIGN (=) characters,

View file

@ -33,8 +33,7 @@ use encoding::label::encoding_from_whatwg_label;
use encoding::types::{DecoderTrap, Encoding, EncodingRef, EncoderTrap};
use hyper::header::Headers;
use hyper::header::common::{Accept, ContentLength, ContentType};
use hyper::header::quality_item::QualityItem;
use hyper::header::{Accept, ContentLength, ContentType, QualityItem};
use hyper::http::RawStatus;
use hyper::mime::{self, Mime};
use hyper::method::Method;
@ -55,7 +54,7 @@ use std::borrow::ToOwned;
use std::cell::Cell;
use std::sync::mpsc::{Sender, Receiver, channel};
use std::default::Default;
use std::io::Timer;
use std::old_io::Timer;
use std::str::FromStr;
use std::time::duration::Duration;
use time;
@ -361,8 +360,8 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
match upper.as_slice() {
"DELETE" | "GET" | "HEAD" | "OPTIONS" |
"POST" | "PUT" | "CONNECT" | "TRACE" |
"TRACK" => upper.parse(),
_ => s.parse()
"TRACK" => upper.parse().ok(),
_ => s.parse().ok()
}
});
// Step 2
@ -830,7 +829,7 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
// Substep 2
status.map(|RawStatus(code, reason)| {
self.status.set(code);
*self.status_text.borrow_mut() = ByteString::new(reason.into_bytes());
*self.status_text.borrow_mut() = ByteString::new(reason.into_owned().into_bytes());
});
headers.as_ref().map(|h| *self.response_headers.borrow_mut() = h.clone());
@ -990,13 +989,13 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
// http://fetch.spec.whatwg.org/#concept-response-header-list
use std::fmt;
use hyper::header::{Header, HeaderFormat};
use hyper::header::common::SetCookie;
use hyper::header::SetCookie;
// a dummy header so we can use headers.remove::<SetCookie2>()
#[derive(Clone)]
struct SetCookie2;
impl Header for SetCookie2 {
fn header_name(_: Option<SetCookie2>) -> &'static str {
fn header_name() -> &'static str {
"set-cookie2"
}

View file

@ -77,7 +77,7 @@ pub struct HitTestResponse(pub UntrustedNodeAddress);
pub struct MouseOverResponse(pub Vec<UntrustedNodeAddress>);
/// Why we're doing reflow.
#[derive(PartialEq, Show)]
#[derive(PartialEq, Debug)]
pub enum ReflowGoal {
/// We're reflowing in order to send a display list to the screen.
ForDisplay,

View file

@ -2,7 +2,7 @@
* 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(unsafe_destructor, plugin, box_syntax, int_uint)]
#![feature(unsafe_destructor, plugin, box_syntax, int_uint, core)]
#![deny(unsafe_blocks)]
#![allow(non_snake_case)]
@ -14,6 +14,7 @@
#[macro_use]
extern crate log;
#[macro_use] extern crate bitflags;
extern crate core;
extern crate devtools_traits;
extern crate cssparser;
@ -26,7 +27,7 @@ extern crate js;
extern crate libc;
extern crate msg;
extern crate net;
extern crate "rustc-serialize" as rustc_serialize;
extern crate "rustc-serialize" as serialize;
extern crate time;
extern crate canvas;
extern crate script_traits;

View file

@ -55,7 +55,8 @@ impl SinkHelpers for servohtmlparser::Sink {
}
}
impl<'a> TreeSink<JS<Node>> for servohtmlparser::Sink {
impl<'a> TreeSink for servohtmlparser::Sink {
type Handle = JS<Node>;
fn get_document(&mut self) -> JS<Node> {
let doc = self.document.root();
let node: JSRef<Node> = NodeCast::from_ref(doc.r());
@ -162,6 +163,10 @@ impl<'a> TreeSink<JS<Node>> for servohtmlparser::Sink {
let script: Option<JSRef<HTMLScriptElement>> = HTMLScriptElementCast::to_ref(node.r());
script.map(|script| script.prepare());
}
fn reparent_children(&mut self, _node: JS<Node>, _new_parent: JS<Node>) {
panic!("unimplemented")
}
}
pub fn parse_html(document: JSRef<Document>,

View file

@ -71,7 +71,7 @@ use util::task_state;
use geom::point::Point2D;
use hyper::header::{Header, Headers, HeaderFormat};
use hyper::header::shared::util as header_util;
use hyper::header::parsing as header_parsing;
use js::jsapi::{JS_SetWrapObjectCallbacks, JS_SetGCZeal, JS_DEFAULT_ZEAL_FREQ, JS_GC};
use js::jsapi::{JSContext, JSRuntime, JSObject};
use js::jsapi::{JS_SetGCParameter, JSGC_MAX_BYTES};
@ -84,7 +84,7 @@ use libc;
use std::any::Any;
use std::borrow::ToOwned;
use std::cell::Cell;
use std::fmt::{self, Show};
use std::fmt::{self, Display};
use std::mem::replace;
use std::num::ToPrimitive;
use std::rc::Rc;
@ -1363,13 +1363,13 @@ struct LastModified(pub Tm);
impl Header for LastModified {
#[inline]
fn header_name(_: Option<LastModified>) -> &'static str {
fn header_name() -> &'static str {
"Last-Modified"
}
// Parses an RFC 2616 compliant date/time string,
fn parse_header(raw: &[Vec<u8>]) -> Option<LastModified> {
header_util::from_one_raw_str(raw).and_then(|s: String| {
header_parsing::from_one_raw_str(raw).and_then(|s: String| {
let s = s.as_slice();
strptime(s, "%a, %d %b %Y %T %Z").or_else(|_| {
strptime(s, "%A, %d-%b-%y %T %Z")
@ -1386,8 +1386,8 @@ impl HeaderFormat for LastModified {
fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
let LastModified(ref tm) = *self;
match tm.tm_utcoff {
0 => tm.rfc822().fmt(f),
_ => tm.to_utc().rfc822().fmt(f)
0 => <_ as Display>::fmt(&tm.rfc822(), f),
_ => <_ as Display>::fmt(&tm.to_utc().rfc822(), f)
}
}
}

View file

@ -24,7 +24,7 @@ use std::collections::HashMap;
use std::sync::mpsc::{channel, Sender};
use std::sync::mpsc::Select;
use std::hash::{Hash, Hasher, Writer};
use std::io::timer::Timer;
use std::old_io::timer::Timer;
use std::time::duration::Duration;
#[derive(PartialEq, Eq)]