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

@ -36,3 +36,4 @@ encoding = "0.2"
matches = "0.1"
url = "0.2.16"
mod_path = "0.1"
bitflags = "*"

View file

@ -2,10 +2,12 @@
* 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::os;
use std::path::Path;
use std::io::process::{Command, ProcessExit, StdioContainer};
use std::io::File;
#![feature(path, io, env)]
use std::env;
use std::old_path::Path;
use std::old_io::process::{Command, ProcessExit, StdioContainer};
use std::old_io::File;
fn main() {
@ -26,6 +28,6 @@ fn main() {
.output()
.unwrap();
assert_eq!(result.status, ProcessExit::ExitStatus(0));
let out = Path::new(os::getenv("OUT_DIR").unwrap());
File::create(&out.join("properties.rs")).unwrap().write(&*result.output).unwrap();
let out = Path::new(env::var_string("OUT_DIR").unwrap());
File::create(&out.join("properties.rs")).unwrap().write_all(&*result.output).unwrap();
}

View file

@ -31,19 +31,19 @@ pub fn iter_font_face_rules_inner<F>(rules: &[CSSRule], device: &Device,
}
}
#[derive(Clone, Show, PartialEq, Eq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum Source {
Url(UrlSource),
Local(String),
}
#[derive(Clone, Show, PartialEq, Eq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct UrlSource {
pub url: Url,
pub format_hints: Vec<String>,
}
#[derive(Show, PartialEq, Eq)]
#[derive(Debug, PartialEq, Eq)]
pub struct FontFaceRule {
pub family: String,
pub sources: Vec<Source>,
@ -58,9 +58,10 @@ pub fn parse_font_face_block(context: &ParserContext, input: &mut Parser)
while let Some(declaration) = iter.next() {
match declaration {
Err(range) => {
let pos = range.start;
let message = format!("Unsupported @font-face descriptor declaration: '{}'",
iter.input.slice(range));
log_css_error(iter.input, range.start, &*message);
log_css_error(iter.input, pos, &*message);
}
Ok(FontFaceDescriptorDeclaration::Family(value)) => {
family = Some(value);

View file

@ -10,6 +10,7 @@
#![allow(unstable)]
#[macro_use] extern crate log;
#[macro_use] extern crate bitflags;
#[no_link] #[macro_use] #[plugin] extern crate string_cache_macros;
extern crate collections;

View file

@ -11,12 +11,12 @@ use util::geometry::{Au, ViewportPx};
use values::{computed, specified};
#[derive(Show, PartialEq)]
#[derive(Debug, PartialEq)]
pub struct MediaQueryList {
media_queries: Vec<MediaQuery>
}
#[derive(PartialEq, Eq, Copy, Show)]
#[derive(PartialEq, Eq, Copy, Debug)]
pub enum Range<T> {
Min(T),
Max(T),
@ -33,18 +33,18 @@ impl<T: Ord> Range<T> {
}
}
#[derive(PartialEq, Eq, Copy, Show)]
#[derive(PartialEq, Eq, Copy, Debug)]
pub enum Expression {
Width(Range<Au>),
}
#[derive(PartialEq, Eq, Copy, Show)]
#[derive(PartialEq, Eq, Copy, Debug)]
pub enum Qualifier {
Only,
Not,
}
#[derive(Show, PartialEq)]
#[derive(Debug, PartialEq)]
pub struct MediaQuery {
qualifier: Option<Qualifier>,
media_type: MediaQueryType,
@ -62,13 +62,13 @@ impl MediaQuery {
}
}
#[derive(PartialEq, Eq, Copy, Show)]
#[derive(PartialEq, Eq, Copy, Debug)]
pub enum MediaQueryType {
All, // Always true
MediaType(MediaType),
}
#[derive(PartialEq, Eq, Copy, Show)]
#[derive(PartialEq, Eq, Copy, Debug)]
pub enum MediaType {
Screen,
Print,
@ -76,7 +76,7 @@ pub enum MediaType {
}
#[allow(missing_copy_implementations)]
#[derive(Show)]
#[derive(Debug)]
pub struct Device {
pub media_type: MediaType,
pub viewport_size: TypedSize2D<ViewportPx, f32>,

View file

@ -9,7 +9,7 @@
use std::ascii::AsciiExt;
use std::borrow::ToOwned;
use std::fmt;
use std::fmt::Show;
use std::fmt::Debug;
use std::sync::Arc;
use util::logical_geometry::{WritingMode, LogicalMargin};
@ -506,7 +506,7 @@ pub mod longhands {
Length(Au),
Number(CSSFloat),
}
impl fmt::Show for T {
impl fmt::Debug for T {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
&T::Normal => write!(f, "normal"),
@ -594,7 +594,7 @@ pub mod longhands {
Length(Au),
Percentage(CSSFloat),
}
impl fmt::Show for T {
impl fmt::Debug for T {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
% for keyword in vertical_align_keywords:
@ -1107,7 +1107,7 @@ pub mod longhands {
Weight${weight},
% endfor
}
impl fmt::Show for T {
impl fmt::Debug for T {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
% for weight in range(100, 901, 100):
@ -1529,7 +1529,7 @@ pub mod longhands {
use text_writer::{self, TextWriter};
use util::cursor::Cursor;
#[derive(Clone, PartialEq, Eq, Copy, Show)]
#[derive(Clone, PartialEq, Eq, Copy, Debug)]
pub enum T {
AutoCursor,
SpecifiedCursor(Cursor),
@ -1667,7 +1667,7 @@ pub mod longhands {
pub inset: bool,
}
impl fmt::Show for BoxShadow {
impl fmt::Debug for BoxShadow {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if self.inset {
let _ = write!(f, "inset ");
@ -1781,7 +1781,7 @@ pub mod longhands {
pub mod computed_value {
use util::geometry::Au;
#[derive(Clone, PartialEq, Eq, Copy, Show)]
#[derive(Clone, PartialEq, Eq, Copy, Debug)]
pub struct ClipRect {
pub top: Au,
pub right: Option<Au>,
@ -1792,7 +1792,7 @@ pub mod longhands {
pub type T = Option<ClipRect>;
}
#[derive(Clone, Show, PartialEq, Copy)]
#[derive(Clone, Debug, PartialEq, Copy)]
pub struct SpecifiedClipRect {
pub top: specified::Length,
pub right: Option<specified::Length>,
@ -1901,7 +1901,7 @@ pub mod longhands {
use text_writer::{self, TextWriter};
// TODO(pcwalton): `blur`, `drop-shadow`
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub enum Filter {
Brightness(CSSFloat),
Contrast(CSSFloat),
@ -1933,7 +1933,7 @@ pub mod longhands {
}
}
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub struct T {
pub filters: Vec<Filter>,
}
@ -2548,7 +2548,7 @@ mod property_bit_field {
/// Declarations are stored in reverse order.
/// Overridden declarations are skipped.
#[derive(Show, PartialEq)]
#[derive(Debug, PartialEq)]
pub struct PropertyDeclarationBlock {
pub important: Arc<Vec<PropertyDeclaration>>,
pub normal: Arc<Vec<PropertyDeclaration>>,
@ -2606,9 +2606,10 @@ pub fn parse_property_declaration_list(context: &ParserContext, input: &mut Pars
}
}
Err(range) => {
let pos = range.start;
let message = format!("Unsupported property declaration: '{}'",
iter.input.slice(range));
log_css_error(iter.input, range.start, &*message);
log_css_error(iter.input, pos, &*message);
}
}
}
@ -2646,7 +2647,7 @@ fn deduplicate_property_declarations(declarations: Vec<PropertyDeclaration>)
}
#[derive(Copy, PartialEq, Eq, Show)]
#[derive(Copy, PartialEq, Eq, Debug)]
pub enum CSSWideKeyword {
InitialKeyword,
InheritKeyword,
@ -2665,7 +2666,7 @@ impl CSSWideKeyword {
}
#[derive(Clone, PartialEq, Eq, Copy, Show)]
#[derive(Clone, PartialEq, Eq, Copy, Debug)]
pub enum DeclaredValue<T> {
SpecifiedValue(T),
Initial,
@ -2813,7 +2814,7 @@ impl PropertyDeclaration {
}
}
impl Show for PropertyDeclaration {
impl Debug for PropertyDeclaration {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}: {}", self.name(), self.value())
}

View file

@ -5,7 +5,6 @@
use std::ascii::AsciiExt;
use std::cmp::Ordering;
use std::collections::HashMap;
use std::hash::Hash;
use std::sync::Arc;
use url::Url;
@ -523,7 +522,7 @@ struct Rule {
/// A property declaration together with its precedence among rules of equal specificity so that
/// we can sort them.
#[derive(Clone, Show)]
#[derive(Clone, Debug)]
pub struct DeclarationBlock {
pub declarations: Arc<Vec<PropertyDeclaration>>,
source_order: uint,

View file

@ -15,14 +15,14 @@ use parser::ParserContext;
use stylesheets::Origin;
#[derive(PartialEq, Clone, Show)]
#[derive(PartialEq, Clone, Debug)]
pub struct Selector {
pub compound_selectors: Arc<CompoundSelector>,
pub pseudo_element: Option<PseudoElement>,
pub specificity: u32,
}
#[derive(Eq, PartialEq, Clone, Hash, Copy, Show)]
#[derive(Eq, PartialEq, Clone, Hash, Copy, Debug)]
pub enum PseudoElement {
Before,
After,
@ -30,13 +30,13 @@ pub enum PseudoElement {
}
#[derive(PartialEq, Clone, Show)]
#[derive(PartialEq, Clone, Debug)]
pub struct CompoundSelector {
pub simple_selectors: Vec<SimpleSelector>,
pub next: Option<(Box<CompoundSelector>, Combinator)>, // c.next is left of c
}
#[derive(PartialEq, Clone, Copy, Show)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum Combinator {
Child, // >
Descendant, // space
@ -44,7 +44,7 @@ pub enum Combinator {
LaterSibling, // ~
}
#[derive(Eq, PartialEq, Clone, Hash, Show)]
#[derive(Eq, PartialEq, Clone, Hash, Debug)]
pub enum SimpleSelector {
ID(Atom),
Class(Atom),
@ -84,27 +84,27 @@ pub enum SimpleSelector {
}
#[derive(Eq, PartialEq, Clone, Hash, Copy, Show)]
#[derive(Eq, PartialEq, Clone, Hash, Copy, Debug)]
pub enum CaseSensitivity {
CaseSensitive, // Selectors spec says language-defined, but HTML says sensitive.
CaseInsensitive,
}
#[derive(Eq, PartialEq, Clone, Hash, Show)]
#[derive(Eq, PartialEq, Clone, Hash, Debug)]
pub struct LocalName {
pub name: Atom,
pub lower_name: Atom,
}
#[derive(Eq, PartialEq, Clone, Hash, Show)]
#[derive(Eq, PartialEq, Clone, Hash, Debug)]
pub struct AttrSelector {
pub name: Atom,
pub lower_name: Atom,
pub namespace: NamespaceConstraint,
}
#[derive(Eq, PartialEq, Clone, Hash, Show)]
#[derive(Eq, PartialEq, Clone, Hash, Debug)]
pub enum NamespaceConstraint {
Any,
Specific(Namespace),
@ -282,7 +282,7 @@ fn parse_type_selector(context: &ParserContext, input: &mut Parser)
}
#[derive(Show)]
#[derive(Debug)]
enum SimpleSelectorParseResult {
SimpleSelector(SimpleSelector),
PseudoElement(PseudoElement),
@ -296,7 +296,7 @@ fn parse_qualified_name<'i, 't>
(context: &ParserContext, input: &mut Parser<'i, 't>,
in_attr_selector: bool)
-> Result<Option<(NamespaceConstraint, Option<CowString<'i>>)>, ()> {
let default_namespace = |:local_name| {
let default_namespace = |local_name| {
let namespace = match context.namespaces.default {
Some(ref ns) => NamespaceConstraint::Specific(ns.clone()),
None => NamespaceConstraint::Any,
@ -304,7 +304,7 @@ fn parse_qualified_name<'i, 't>
Ok(Some((namespace, local_name)))
};
let explicit_namespace = |&: input: &mut Parser<'i, 't>, namespace| {
let explicit_namespace = |input: &mut Parser<'i, 't>, namespace| {
match input.next_including_whitespace() {
Ok(Token::Delim('*')) if !in_attr_selector => {
Ok(Some((namespace, None)))

View file

@ -19,7 +19,7 @@ use media_queries::{self, Device, MediaQueryList, parse_media_query_list};
use font_face::{FontFaceRule, Source, parse_font_face_block, iter_font_face_rules_inner};
#[derive(Clone, PartialEq, Eq, Copy, Show)]
#[derive(Clone, PartialEq, Eq, Copy, Debug)]
pub enum Origin {
UserAgent,
Author,
@ -27,7 +27,7 @@ pub enum Origin {
}
#[derive(Show, PartialEq)]
#[derive(Debug, PartialEq)]
pub struct Stylesheet {
/// List of rules in the order they were found (important for
/// cascading order)
@ -36,7 +36,7 @@ pub struct Stylesheet {
}
#[derive(Show, PartialEq)]
#[derive(Debug, PartialEq)]
pub enum CSSRule {
Charset(String),
Namespace(Option<String>, Namespace),
@ -45,14 +45,14 @@ pub enum CSSRule {
FontFace(FontFaceRule),
}
#[derive(Show, PartialEq)]
#[derive(Debug, PartialEq)]
pub struct MediaRule {
pub media_queries: MediaQueryList,
pub rules: Vec<CSSRule>,
}
#[derive(Show, PartialEq)]
#[derive(Debug, PartialEq)]
pub struct StyleRule {
pub selectors: Vec<Selector>,
pub declarations: PropertyDeclarationBlock,
@ -106,8 +106,9 @@ impl Stylesheet {
rules.push(rule);
}
Err(range) => {
let pos = range.start;
let message = format!("Invalid rule: '{}'", iter.input.slice(range));
log_css_error(iter.input, range.start, &*message);
log_css_error(iter.input, pos, &*message);
}
}
}
@ -126,8 +127,9 @@ fn parse_nested_rules(context: &ParserContext, input: &mut Parser) -> Vec<CSSRul
match result {
Ok(rule) => rules.push(rule),
Err(range) => {
let pos = range.start;
let message = format!("Unsupported rule: '{}'", iter.input.slice(range));
log_css_error(iter.input, range.start, &*message);
log_css_error(iter.input, pos, &*message);
}
}
}

View file

@ -27,7 +27,7 @@ macro_rules! define_css_keyword_enum {
}
}
impl ::std::fmt::Show for $name {
impl ::std::fmt::Debug for $name {
#[inline]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
use cssparser::ToCss;
@ -53,7 +53,7 @@ pub mod specified {
use std::ascii::AsciiExt;
use std::f64::consts::PI;
use std::fmt;
use std::fmt::{Formatter, Show};
use std::fmt::{Formatter, Debug};
use url::Url;
use cssparser::{self, Token, Parser, ToCss, CssStringWriter};
use parser::ParserContext;
@ -82,7 +82,7 @@ pub mod specified {
}
}
impl fmt::Show for CSSColor {
impl fmt::Debug for CSSColor {
#[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.fmt_to_css(f) }
}
@ -100,7 +100,7 @@ pub mod specified {
pub parsed: cssparser::RGBA,
pub authored: Option<String>,
}
impl fmt::Show for CSSRGBA {
impl fmt::Debug for CSSRGBA {
#[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.fmt_to_css(f) }
}
@ -116,7 +116,7 @@ pub mod specified {
#[derive(Clone, PartialEq)]
pub struct CSSImage(pub Option<Image>);
impl fmt::Show for CSSImage {
impl fmt::Debug for CSSImage {
#[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.fmt_to_css(f) }
}
@ -143,7 +143,7 @@ pub mod specified {
ServoCharacterWidth(i32),
}
impl fmt::Show for Length {
impl fmt::Debug for Length {
#[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.fmt_to_css(f) }
}
@ -211,7 +211,7 @@ pub mod specified {
Percentage(CSSFloat), // [0 .. 100%] maps to [0.0 .. 1.0]
}
impl fmt::Show for LengthOrPercentage {
impl fmt::Debug for LengthOrPercentage {
#[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.fmt_to_css(f) }
}
@ -259,7 +259,7 @@ pub mod specified {
Auto,
}
impl fmt::Show for LengthOrPercentageOrAuto {
impl fmt::Debug for LengthOrPercentageOrAuto {
#[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.fmt_to_css(f) }
}
@ -310,7 +310,7 @@ pub mod specified {
None,
}
impl fmt::Show for LengthOrPercentageOrNone {
impl fmt::Debug for LengthOrPercentageOrNone {
#[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.fmt_to_css(f) }
}
@ -409,7 +409,7 @@ pub mod specified {
#[derive(Clone, PartialEq, PartialOrd, Copy)]
pub struct Angle(pub CSSFloat);
impl fmt::Show for Angle {
impl fmt::Debug for Angle {
#[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.fmt_to_css(f) }
}
@ -457,7 +457,7 @@ pub mod specified {
LinearGradient(LinearGradient),
}
impl fmt::Show for Image {
impl fmt::Debug for Image {
#[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.fmt_to_css(f) }
}
@ -515,7 +515,7 @@ pub mod specified {
pub stops: Vec<ColorStop>,
}
impl fmt::Show for LinearGradient {
impl fmt::Debug for LinearGradient {
#[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.fmt_to_css(f) }
}
@ -539,7 +539,7 @@ pub mod specified {
Corner(HorizontalDirection, VerticalDirection),
}
impl fmt::Show for AngleOrCorner {
impl fmt::Debug for AngleOrCorner {
#[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.fmt_to_css(f) }
}
@ -569,7 +569,7 @@ pub mod specified {
pub position: Option<LengthOrPercentage>,
}
impl fmt::Show for ColorStop {
impl fmt::Debug for ColorStop {
#[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.fmt_to_css(f) }
}
@ -748,7 +748,7 @@ pub mod computed {
Length(Au),
Percentage(CSSFloat),
}
impl fmt::Show for LengthOrPercentage {
impl fmt::Debug for LengthOrPercentage {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
&LengthOrPercentage::Length(length) => write!(f, "{:?}", length),
@ -774,7 +774,7 @@ pub mod computed {
Percentage(CSSFloat),
Auto,
}
impl fmt::Show for LengthOrPercentageOrAuto {
impl fmt::Debug for LengthOrPercentageOrAuto {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
&LengthOrPercentageOrAuto::Length(length) => write!(f, "{:?}", length),
@ -802,7 +802,7 @@ pub mod computed {
Percentage(CSSFloat),
None,
}
impl fmt::Show for LengthOrPercentageOrNone {
impl fmt::Debug for LengthOrPercentageOrNone {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
&LengthOrPercentageOrNone::Length(length) => write!(f, "{:?}", length),
@ -831,7 +831,7 @@ pub mod computed {
LinearGradient(LinearGradient),
}
impl fmt::Show for Image {
impl fmt::Debug for Image {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
&Image::Url(ref url) => write!(f, "url(\"{}\")", url),
@ -850,7 +850,7 @@ pub mod computed {
pub stops: Vec<ColorStop>,
}
impl fmt::Show for LinearGradient {
impl fmt::Debug for LinearGradient {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let _ = write!(f, "{:?}", self.angle_or_corner);
for stop in self.stops.iter() {
@ -871,7 +871,7 @@ pub mod computed {
pub position: Option<LengthOrPercentage>,
}
impl fmt::Show for ColorStop {
impl fmt::Debug for ColorStop {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let _ = write!(f, "{:?}", self.color);
self.position.map(|pos| {