]> git.lizzy.rs Git - rust.git/commitdiff
auto merge of #14831 : alexcrichton/rust/format-intl, r=brson
authorbors <bors@rust-lang.org>
Fri, 13 Jun 2014 14:42:03 +0000 (14:42 +0000)
committerbors <bors@rust-lang.org>
Fri, 13 Jun 2014 14:42:03 +0000 (14:42 +0000)
* The select/plural methods from format strings are removed
* The # character no longer needs to be escaped
* The \-based escapes have been removed
* '{{' is now an escape for '{'
* '}}' is now an escape for '}'

Closes #14810
[breaking-change]

1  2 
src/libcore/fmt/mod.rs
src/librustc/middle/lint.rs
src/librustc/middle/resolve.rs
src/librustc/middle/ty.rs
src/libserialize/json.rs
src/libstd/path/windows.rs
src/libsyntax/parse/parser.rs
src/libtest/stats.rs
src/test/run-pass/ifmt.rs

diff --combined src/libcore/fmt/mod.rs
index 0770c44dfbc1e28ccb952a64ba3b9a2fe4da73bf,a8d458664b8667be62658a455dcc19bd56c6724d..053dbbe5da9d8c983aa4a81b3d76021697bfe05a
  #![allow(unused_variable)]
  
  use any;
 -use cell::Cell;
 +use cell::{Cell, Ref, RefMut};
  use char::Char;
  use collections::Collection;
  use iter::{Iterator, range};
  use kinds::Copy;
  use mem;
  use option::{Option, Some, None};
 +use ops::Deref;
  use result::{Ok, Err};
  use result;
  use slice::{Vector, ImmutableVector};
@@@ -98,12 -97,6 +98,6 @@@ pub struct Formatter<'a> 
      args: &'a [Argument<'a>],
  }
  
- enum CurrentlyFormatting<'a> {
-     Nothing,
-     RawString(&'a str),
-     Number(uint),
- }
  /// This struct represents the generic "argument" which is taken by the Xprintf
  /// family of functions. It contains a function to format the given value. At
  /// compile time it is ensured that the function and the value have the correct
@@@ -280,7 -273,7 +274,7 @@@ pub fn write(output: &mut FormatWriter
          curarg: args.args.iter(),
      };
      for piece in args.fmt.iter() {
-         try!(formatter.run(piece, Nothing));
+         try!(formatter.run(piece));
      }
      Ok(())
  }
@@@ -291,16 -284,9 +285,9 @@@ impl<'a> Formatter<'a> 
      // at runtime. This consumes all of the compile-time statics generated by
      // the format! syntax extension.
  
-     fn run(&mut self, piece: &rt::Piece, cur: CurrentlyFormatting) -> Result {
+     fn run(&mut self, piece: &rt::Piece) -> Result {
          match *piece {
              rt::String(s) => self.buf.write(s.as_bytes()),
-             rt::CurrentArgument(()) => {
-                 match cur {
-                     Nothing => Ok(()),
-                     Number(n) => secret_show(&radix(n, 10), self),
-                     RawString(s) => self.buf.write(s.as_bytes()),
-                 }
-             }
              rt::Argument(ref arg) => {
                  // Fill in the format parameters into the formatter
                  self.fill = arg.format.fill;
                  };
  
                  // Then actually do some printing
-                 match arg.method {
-                     None => (value.formatter)(value.value, self),
-                     Some(ref method) => self.execute(*method, value)
-                 }
+                 (value.formatter)(value.value, self)
              }
          }
      }
          }
      }
  
-     fn execute(&mut self, method: &rt::Method, arg: Argument) -> Result {
-         match *method {
-             // Pluralization is selection upon a numeric value specified as the
-             // parameter.
-             rt::Plural(offset, ref selectors, ref default) => {
-                 // This is validated at compile-time to be a pointer to a
-                 // '&uint' value.
-                 let value: &uint = unsafe { mem::transmute(arg.value) };
-                 let value = *value;
-                 // First, attempt to match against explicit values without the
-                 // offsetted value
-                 for s in selectors.iter() {
-                     match s.selector {
-                         rt::Literal(val) if value == val => {
-                             return self.runplural(value, s.result);
-                         }
-                         _ => {}
-                     }
-                 }
-                 // Next, offset the value and attempt to match against the
-                 // keyword selectors.
-                 let value = value - match offset { Some(i) => i, None => 0 };
-                 for s in selectors.iter() {
-                     let run = match s.selector {
-                         rt::Keyword(rt::Zero) => value == 0,
-                         rt::Keyword(rt::One) => value == 1,
-                         rt::Keyword(rt::Two) => value == 2,
-                         // FIXME: Few/Many should have a user-specified boundary
-                         //      One possible option would be in the function
-                         //      pointer of the 'arg: Argument' struct.
-                         rt::Keyword(rt::Few) => value < 8,
-                         rt::Keyword(rt::Many) => value >= 8,
-                         rt::Literal(..) => false
-                     };
-                     if run {
-                         return self.runplural(value, s.result);
-                     }
-                 }
-                 self.runplural(value, *default)
-             }
-             // Select is just a matching against the string specified.
-             rt::Select(ref selectors, ref default) => {
-                 // This is validated at compile-time to be a pointer to a
-                 // string slice,
-                 let value: & &str = unsafe { mem::transmute(arg.value) };
-                 let value = *value;
-                 for s in selectors.iter() {
-                     if s.selector == value {
-                         for piece in s.result.iter() {
-                             try!(self.run(piece, RawString(value)));
-                         }
-                         return Ok(());
-                     }
-                 }
-                 for piece in default.iter() {
-                     try!(self.run(piece, RawString(value)));
-                 }
-                 Ok(())
-             }
-         }
-     }
-     fn runplural(&mut self, value: uint, pieces: &[rt::Piece]) -> Result {
-         for piece in pieces.iter() {
-             try!(self.run(piece, Number(value)));
-         }
-         Ok(())
-     }
      // Helper methods used for padding and processing formatting arguments that
      // all formatting traits can use.
  
@@@ -829,6 -736,12 +737,6 @@@ impl<'a, T: Show> Show for &'a mut [T] 
      }
  }
  
 -impl<T: Show> Show for ~[T] {
 -    fn fmt(&self, f: &mut Formatter) -> Result {
 -        secret_show(&self.as_slice(), f)
 -    }
 -}
 -
  impl Show for () {
      fn fmt(&self, f: &mut Formatter) -> Result {
          f.pad("()")
  }
  
  impl<T: Copy + Show> Show for Cell<T> {
+     #[cfg(stage0)]
      fn fmt(&self, f: &mut Formatter) -> Result {
          write!(f, r"Cell \{ value: {} \}", self.get())
      }
+     #[cfg(not(stage0))]
+     fn fmt(&self, f: &mut Formatter) -> Result {
+         write!(f, "Cell {{ value: {} }}", self.get())
+     }
  }
  
 +impl<'b, T: Show> Show for Ref<'b, T> {
 +    fn fmt(&self, f: &mut Formatter) -> Result {
 +        (**self).fmt(f)
 +    }
 +}
 +
 +impl<'b, T: Show> Show for RefMut<'b, T> {
 +    fn fmt(&self, f: &mut Formatter) -> Result {
 +        (*(self.deref())).fmt(f)
 +    }
 +}
 +
  // If you expected tests to be here, look instead at the run-pass/ifmt.rs test,
  // it's a lot easier than creating all of the rt::Piece structures here.
index 389a73c357b7d473d685ecce39d6be7b5c85de61,3cf7602491ae0be8cae618259bf55e680d5b472f..b3b690c804d231282dff3eaebcf594adeaa1d52c
@@@ -121,6 -121,8 +121,6 @@@ pub enum Lint 
      UnusedMustUse,
      UnusedResult,
  
 -    DeprecatedOwnedVector,
 -
      Warnings,
  
      RawPointerDeriving,
@@@ -431,6 -433,13 +431,6 @@@ static lint_table: &'static [(&'static 
          default: Allow,
      }),
  
 -    ("deprecated_owned_vector",
 -     LintSpec {
 -        lint: DeprecatedOwnedVector,
 -        desc: "use of a `~[T]` vector",
 -        default: Allow,
 -    }),
 -
      ("raw_pointer_deriving",
       LintSpec {
          lint: RawPointerDeriving,
@@@ -484,10 -493,16 +484,16 @@@ pub fn emit_lint(level: Level, src: Lin
  
      let mut note = None;
      let msg = match src {
+         #[cfg(stage0)]
          Default => {
              format!("{}, \\#[{}({})] on by default", msg,
                  level_to_str(level), lint_str)
          },
+         #[cfg(not(stage0))]
+         Default => {
+             format!("{}, #[{}({})] on by default", msg,
+                 level_to_str(level), lint_str)
+         },
          CommandLine => {
              format!("{} [-{} {}]", msg,
                  match level {
@@@ -1220,6 -1235,20 +1226,6 @@@ fn check_unused_result(cx: &Context, s
      }
  }
  
 -fn check_deprecated_owned_vector(cx: &Context, e: &ast::Expr) {
 -    let t = ty::expr_ty(cx.tcx, e);
 -    match ty::get(t).sty {
 -        ty::ty_uniq(t) => match ty::get(t).sty {
 -            ty::ty_vec(_, None) => {
 -                cx.span_lint(DeprecatedOwnedVector, e.span,
 -                             "use of deprecated `~[]` vector; replaced by `std::vec::Vec`")
 -            }
 -            _ => {}
 -        },
 -        _ => {}
 -    }
 -}
 -
  fn check_item_non_camel_case_types(cx: &Context, it: &ast::Item) {
      fn is_camel_case(ident: ast::Ident) -> bool {
          let ident = token::get_ident(ident);
@@@ -1832,6 -1861,7 +1838,6 @@@ impl<'a> Visitor<()> for Context<'a> 
  
          check_type_limits(self, e);
          check_unused_casts(self, e);
 -        check_deprecated_owned_vector(self, e);
  
          visit::walk_expr(self, e, ());
      }
index 85de170ed99e941e700d87dca777b29e9352eebf,d1c7baf9f177d08028e4e4bd6ec22f13db5857fd..7fc31c974e939788a020438e0ff4431609990f1b
@@@ -3812,10 -3812,9 +3812,10 @@@ impl<'a> Resolver<'a> 
                  }
                  Some(declaration) => {
                      for argument in declaration.inputs.iter() {
 +                        let mut bindings_list = HashMap::new();
                          this.resolve_pattern(&*argument.pat,
                                               ArgumentIrrefutableMode,
 -                                             None);
 +                                             &mut bindings_list);
  
                          this.resolve_type(&*argument.ty);
  
          }
  
          // Resolve the pattern.
 -        self.resolve_pattern(&*local.pat, LocalIrrefutableMode, None);
 +        let mut bindings_list = HashMap::new();
 +        self.resolve_pattern(&*local.pat,
 +                             LocalIrrefutableMode,
 +                             &mut bindings_list);
      }
  
      // build a map from pattern identifiers to binding-info's.
  
              for (&key, &binding_0) in map_0.iter() {
                  match map_i.find(&key) {
+                   #[cfg(stage0)]
                    None => {
                      self.resolve_error(
                          p.span,
                                  token::get_name(key),
                                  i + 1).as_slice());
                    }
+                   #[cfg(not(stage0))]
+                   None => {
+                     self.resolve_error(
+                         p.span,
+                         format!("variable `{}` from pattern #1 is \
+                                   not bound in pattern #{}",
+                                 token::get_name(key),
+                                 i + 1).as_slice());
+                   }
+                   #[cfg(stage0)]
                    Some(binding_i) => {
                      if binding_0.binding_mode != binding_i.binding_mode {
                          self.resolve_error(
                                      i + 1).as_slice());
                      }
                    }
+                   #[cfg(not(stage0))]
+                   Some(binding_i) => {
+                     if binding_0.binding_mode != binding_i.binding_mode {
+                         self.resolve_error(
+                             binding_i.span,
+                             format!("variable `{}` is bound with different \
+                                       mode in pattern #{} than in pattern #1",
+                                     token::get_name(key),
+                                     i + 1).as_slice());
+                     }
+                   }
                  }
              }
  
                  if !map_0.contains_key(&key) {
                      self.resolve_error(
                          binding.span,
-                         format!("variable `{}` from pattern \\#{} is \
-                                   not bound in pattern \\#1",
+                         format!("variable `{}` from pattern {}{} is \
+                                   not bound in pattern {}1",
                                  token::get_name(key),
-                                 i + 1).as_slice());
+                                 "#", i + 1, "#").as_slice());
                  }
              }
          }
  
          let mut bindings_list = HashMap::new();
          for pattern in arm.pats.iter() {
 -            self.resolve_pattern(&**pattern,
 -                                 RefutableMode,
 -                                 Some(&mut bindings_list));
 +            self.resolve_pattern(&**pattern, RefutableMode, &mut bindings_list);
          }
  
          // This has to happen *after* we determine which
                         mode: PatternBindingMode,
                         // Maps idents to the node ID for the (outermost)
                         // pattern that binds them
 -                       mut bindings_list: Option<&mut HashMap<Name,NodeId>>) {
 +                       bindings_list: &mut HashMap<Name,NodeId>) {
          let pat_id = pattern.id;
          walk_pat(pattern, |pattern| {
              match pattern.node {
                              // because that breaks the assumptions later
                              // passes make about or-patterns.)
  
 -                            match bindings_list {
 -                                Some(ref mut bindings_list)
 -                                if !bindings_list.contains_key(&renamed) => {
 -                                    let this = &mut *self;
 -                                    let value_ribs = this.value_ribs.borrow();
 -                                    let length = value_ribs.len();
 -                                    let last_rib = value_ribs.get(
 -                                        length - 1);
 -                                    last_rib.bindings.borrow_mut()
 -                                            .insert(renamed, DlDef(def));
 -                                    bindings_list.insert(renamed, pat_id);
 -                                }
 -                                Some(ref mut b) => {
 -                                  if b.find(&renamed) == Some(&pat_id) {
 -                                      // Then this is a duplicate variable
 -                                      // in the same disjunct, which is an
 -                                      // error
 -                                     self.resolve_error(pattern.span,
 -                                       format!("identifier `{}` is bound \
 -                                                more than once in the same \
 -                                                pattern",
 -                                               path_to_str(path)).as_slice());
 -                                  }
 -                                  // Not bound in the same pattern: do nothing
 -                                }
 -                                None => {
 -                                    let this = &mut *self;
 -                                    {
 -                                        let value_ribs = this.value_ribs.borrow();
 -                                        let length = value_ribs.len();
 -                                        let last_rib = value_ribs.get(
 -                                                length - 1);
 -                                        last_rib.bindings.borrow_mut()
 -                                                .insert(renamed, DlDef(def));
 -                                    }
 -                                }
 +                            if !bindings_list.contains_key(&renamed) {
 +                                let this = &mut *self;
 +                                let value_ribs = this.value_ribs.borrow();
 +                                let length = value_ribs.len();
 +                                let last_rib = value_ribs.get(
 +                                    length - 1);
 +                                last_rib.bindings.borrow_mut()
 +                                        .insert(renamed, DlDef(def));
 +                                bindings_list.insert(renamed, pat_id);
 +                            } else if bindings_list.find(&renamed) ==
 +                                    Some(&pat_id) {
 +                                // Then this is a duplicate variable in the
 +                                // same disjunction, which is an error.
 +                                self.resolve_error(pattern.span,
 +                                    format!("identifier `{}` is bound \
 +                                             more than once in the same \
 +                                             pattern",
 +                                            path_to_str(path)).as_slice());
                              }
 +                            // Else, not bound in the same pattern: do
 +                            // nothing.
                          }
                      }
  
                          // structs, which wouldn't result in this error.)
                          match self.with_no_errors(|this|
                              this.resolve_path(expr.id, path, TypeNS, false)) {
+                             #[cfg(stage0)]
                              Some((DefTy(struct_id), _))
                                if self.structs.contains_key(&struct_id) => {
                                  self.resolve_error(expr.span,
                                              `{} \\{ /* fields */ \\}`?",
                                              wrong_name).as_slice());
  
+                             }
+                             #[cfg(not(stage0))]
+                             Some((DefTy(struct_id), _))
+                               if self.structs.contains_key(&struct_id) => {
+                                 self.resolve_error(expr.span,
+                                         format!("`{}` is a structure name, but \
+                                                  this expression \
+                                                  uses it like a function name",
+                                                 wrong_name).as_slice());
+                                 self.session.span_note(expr.span,
+                                     format!("Did you mean to write: \
+                                             `{} {{ /* fields */ }}`?",
+                                             wrong_name).as_slice());
                              }
                              _ => {
                                  let mut method_scope = false;
index a04f198da368d36f87c56a44efeb46f547cf59e0,c2c71ba32f312acda994b18ec029534f64b77616..2a0873e327bc258125f8ab6f981e6c99fd22e2b6
@@@ -884,9 -884,14 +884,14 @@@ impl Vid for TyVid 
  }
  
  impl fmt::Show for TyVid {
+     #[cfg(stage0)]
      fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result{
          write!(f, "<generic \\#{}>", self.to_uint())
      }
+     #[cfg(not(stage0))]
+     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result{
+         write!(f, "<generic #{}>", self.to_uint())
+     }
  }
  
  impl Vid for IntVid {
  }
  
  impl fmt::Show for IntVid {
+     #[cfg(stage0)]
      fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
          write!(f, "<generic integer \\#{}>", self.to_uint())
      }
+     #[cfg(not(stage0))]
+     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+         write!(f, "<generic integer #{}>", self.to_uint())
+     }
  }
  
  impl Vid for FloatVid {
  }
  
  impl fmt::Show for FloatVid {
+     #[cfg(stage0)]
      fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
          write!(f, "<generic float \\#{}>", self.to_uint())
      }
+     #[cfg(not(stage0))]
+     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+         write!(f, "<generic float #{}>", self.to_uint())
+     }
  }
  
  impl Vid for RegionVid {
@@@ -4373,27 -4388,6 +4388,27 @@@ pub fn trait_id_of_impl(tcx: &ctxt
          }
          _ => None
      }
 +}
 +
 +/// If the given def ID describes a method belonging to an impl, return the
 +/// ID of the impl that the method belongs to. Otherwise, return `None`.
 +pub fn impl_of_method(tcx: &ctxt, def_id: ast::DefId)
 +                       -> Option<ast::DefId> {
 +    if def_id.krate != LOCAL_CRATE {
 +        return match csearch::get_method(tcx, def_id).container {
 +            TraitContainer(_) => None,
 +            ImplContainer(def_id) => Some(def_id),
 +        };
 +    }
 +    match tcx.methods.borrow().find_copy(&def_id) {
 +        Some(method) => {
 +            match method.container {
 +                TraitContainer(_) => None,
 +                ImplContainer(def_id) => Some(def_id),
 +            }
 +        }
 +        None => None
 +    }
  }
  
  /// If the given def ID describes a method belonging to a trait (either a
diff --combined src/libserialize/json.rs
index a5c2042c979eecc60f214633872be06b35cfec9e,f8b2bd3ff9ff4cbacb9fa36c9f3027cc505b67bb..8dfd4e778c2a8f8ac9f9c25db06257af55823dc1
@@@ -81,7 -81,7 +81,7 @@@ fn main() 
  ```
  
  Two wrapper functions are provided to encode a Encodable object
 -into a string (String) or buffer (~[u8]): `str_encode(&m)` and `buffer_encode(&m)`.
 +into a string (String) or buffer (vec![u8]): `str_encode(&m)` and `buffer_encode(&m)`.
  
  ```rust
  use serialize::json;
@@@ -430,6 -430,7 +430,7 @@@ impl<'a> ::Encoder<io::IoError> for Enc
                   _name: &str,
                   f: |&mut Encoder<'a>| -> EncodeResult) -> EncodeResult { f(self) }
  
+     #[cfg(stage0)]
      fn emit_enum_variant(&mut self,
                           name: &str,
                           _id: uint,
              write!(self.wr, "]\\}")
          }
      }
+     #[cfg(not(stage0))]
+     fn emit_enum_variant(&mut self,
+                          name: &str,
+                          _id: uint,
+                          cnt: uint,
+                          f: |&mut Encoder<'a>| -> EncodeResult) -> EncodeResult {
+         // enums are encoded as strings or objects
+         // Bunny => "Bunny"
+         // Kangaroo(34,"William") => {"variant": "Kangaroo", "fields": [34,"William"]}
+         if cnt == 0 {
+             write!(self.wr, "{}", escape_str(name))
+         } else {
+             try!(write!(self.wr, "{{\"variant\":"));
+             try!(write!(self.wr, "{}", escape_str(name)));
+             try!(write!(self.wr, ",\"fields\":["));
+             try!(f(self));
+             write!(self.wr, "]}}")
+         }
+     }
  
      fn emit_enum_variant_arg(&mut self,
                               idx: uint,
          self.emit_enum_variant_arg(idx, f)
      }
  
+     #[cfg(stage0)]
      fn emit_struct(&mut self,
                     _: &str,
                     _: uint,
          try!(f(self));
          write!(self.wr, r"\}")
      }
+     #[cfg(not(stage0))]
+     fn emit_struct(&mut self,
+                    _: &str,
+                    _: uint,
+                    f: |&mut Encoder<'a>| -> EncodeResult) -> EncodeResult {
+         try!(write!(self.wr, "{{"));
+         try!(f(self));
+         write!(self.wr, "}}")
+     }
  
      fn emit_struct_field(&mut self,
                           name: &str,
          f(self)
      }
  
+     #[cfg(stage0)]
      fn emit_map(&mut self, _len: uint, f: |&mut Encoder<'a>| -> EncodeResult) -> EncodeResult {
          try!(write!(self.wr, r"\{"));
          try!(f(self));
          write!(self.wr, r"\}")
      }
+     #[cfg(not(stage0))]
+     fn emit_map(&mut self, _len: uint, f: |&mut Encoder<'a>| -> EncodeResult) -> EncodeResult {
+         try!(write!(self.wr, "{{"));
+         try!(f(self));
+         write!(self.wr, "}}")
+     }
  
      fn emit_map_elt_key(&mut self,
                          idx: uint,
@@@ -670,6 -707,7 +707,7 @@@ impl<'a> ::Encoder<io::IoError> for Pre
      }
  
  
+     #[cfg(stage0)]
      fn emit_struct(&mut self,
                     _: &str,
                     len: uint,
              write!(self.wr, "\n{}\\}", spaces(self.indent))
          }
      }
+     #[cfg(not(stage0))]
+     fn emit_struct(&mut self,
+                    _: &str,
+                    len: uint,
+                    f: |&mut PrettyEncoder<'a>| -> EncodeResult) -> EncodeResult {
+         if len == 0 {
+             write!(self.wr, "{{}}")
+         } else {
+             try!(write!(self.wr, "{{"));
+             self.indent += 2;
+             try!(f(self));
+             self.indent -= 2;
+             write!(self.wr, "\n{}}}", spaces(self.indent))
+         }
+     }
  
      fn emit_struct_field(&mut self,
                           name: &str,
          f(self)
      }
  
+     #[cfg(stage0)]
      fn emit_map(&mut self,
                  len: uint,
                  f: |&mut PrettyEncoder<'a>| -> EncodeResult) -> EncodeResult {
              write!(self.wr, "\n{}\\}", spaces(self.indent))
          }
      }
+     #[cfg(not(stage0))]
+     fn emit_map(&mut self,
+                 len: uint,
+                 f: |&mut PrettyEncoder<'a>| -> EncodeResult) -> EncodeResult {
+         if len == 0 {
+             write!(self.wr, "{{}}")
+         } else {
+             try!(write!(self.wr, "{{"));
+             self.indent += 2;
+             try!(f(self));
+             self.indent -= 2;
+             write!(self.wr, "\n{}}}", spaces(self.indent))
+         }
+     }
  
      fn emit_map_elt_key(&mut self,
                          idx: uint,
@@@ -2225,6 -2293,10 +2293,6 @@@ impl<'a, A:ToJson> ToJson for &'a [A] 
      fn to_json(&self) -> Json { List(self.iter().map(|elt| elt.to_json()).collect()) }
  }
  
 -impl<A:ToJson> ToJson for ~[A] {
 -    fn to_json(&self) -> Json { List(self.iter().map(|elt| elt.to_json()).collect()) }
 -}
 -
  impl<A:ToJson> ToJson for Vec<A> {
      fn to_json(&self) -> Json { List(self.iter().map(|elt| elt.to_json()).collect()) }
  }
@@@ -3044,8 -3116,7 +3112,8 @@@ mod tests 
          let _hm: HashMap<uint, bool> = Decodable::decode(&mut decoder).unwrap();
      }
  
 -    fn assert_stream_equal(src: &str, expected: ~[(JsonEvent, ~[StackElement])]) {
 +    fn assert_stream_equal(src: &str,
 +                           expected: Vec<(JsonEvent, Vec<StackElement>)>) {
          let mut parser = Parser::new(src.chars());
          let mut i = 0;
          loop {
                  Some(e) => e,
                  None => { break; }
              };
 -            let (ref expected_evt, ref expected_stack) = expected[i];
 +            let (ref expected_evt, ref expected_stack) = *expected.get(i);
              if !parser.stack().is_equal_to(expected_stack.as_slice()) {
                  fail!("Parser stack is not equal to {}", expected_stack);
              }
          }
      }
      #[test]
 +    #[ignore(cfg(target_word_size = "32"))] // FIXME(#14064)
      fn test_streaming_parser() {
          assert_stream_equal(
              r#"{ "foo":"bar", "array" : [0, 1, 2,3 ,4,5], "idents":[null,true,false]}"#,
 -            ~[
 -                (ObjectStart,             ~[]),
 -                  (StringValue("bar".to_string()),   ~[Key("foo")]),
 -                  (ListStart,             ~[Key("array")]),
 -                    (NumberValue(0.0),    ~[Key("array"), Index(0)]),
 -                    (NumberValue(1.0),    ~[Key("array"), Index(1)]),
 -                    (NumberValue(2.0),    ~[Key("array"), Index(2)]),
 -                    (NumberValue(3.0),    ~[Key("array"), Index(3)]),
 -                    (NumberValue(4.0),    ~[Key("array"), Index(4)]),
 -                    (NumberValue(5.0),    ~[Key("array"), Index(5)]),
 -                  (ListEnd,               ~[Key("array")]),
 -                  (ListStart,             ~[Key("idents")]),
 -                    (NullValue,           ~[Key("idents"), Index(0)]),
 -                    (BooleanValue(true),  ~[Key("idents"), Index(1)]),
 -                    (BooleanValue(false), ~[Key("idents"), Index(2)]),
 -                  (ListEnd,               ~[Key("idents")]),
 -                (ObjectEnd,               ~[]),
 +            vec![
 +                (ObjectStart,             vec![]),
 +                  (StringValue("bar".to_string()),   vec![Key("foo")]),
 +                  (ListStart,             vec![Key("array")]),
 +                    (NumberValue(0.0),    vec![Key("array"), Index(0)]),
 +                    (NumberValue(1.0),    vec![Key("array"), Index(1)]),
 +                    (NumberValue(2.0),    vec![Key("array"), Index(2)]),
 +                    (NumberValue(3.0),    vec![Key("array"), Index(3)]),
 +                    (NumberValue(4.0),    vec![Key("array"), Index(4)]),
 +                    (NumberValue(5.0),    vec![Key("array"), Index(5)]),
 +                  (ListEnd,               vec![Key("array")]),
 +                  (ListStart,             vec![Key("idents")]),
 +                    (NullValue,           vec![Key("idents"), Index(0)]),
 +                    (BooleanValue(true),  vec![Key("idents"), Index(1)]),
 +                    (BooleanValue(false), vec![Key("idents"), Index(2)]),
 +                  (ListEnd,               vec![Key("idents")]),
 +                (ObjectEnd,               vec![]),
              ]
          );
      }
  
          assert_stream_equal(
              "{}",
 -            box [(ObjectStart, box []), (ObjectEnd, box [])]
 +            vec![(ObjectStart, vec![]), (ObjectEnd, vec![])]
          );
          assert_stream_equal(
              "{\"a\": 3}",
 -            box [
 -                (ObjectStart,        box []),
 -                  (NumberValue(3.0), box [Key("a")]),
 -                (ObjectEnd,          box []),
 +            vec![
 +                (ObjectStart,        vec![]),
 +                  (NumberValue(3.0), vec![Key("a")]),
 +                (ObjectEnd,          vec![]),
              ]
          );
          assert_stream_equal(
              "{ \"a\": null, \"b\" : true }",
 -            box [
 -                (ObjectStart,           box []),
 -                  (NullValue,           box [Key("a")]),
 -                  (BooleanValue(true),  box [Key("b")]),
 -                (ObjectEnd,             box []),
 +            vec![
 +                (ObjectStart,           vec![]),
 +                  (NullValue,           vec![Key("a")]),
 +                  (BooleanValue(true),  vec![Key("b")]),
 +                (ObjectEnd,             vec![]),
              ]
          );
          assert_stream_equal(
              "{\"a\" : 1.0 ,\"b\": [ true ]}",
 -            box [
 -                (ObjectStart,           box []),
 -                  (NumberValue(1.0),    box [Key("a")]),
 -                  (ListStart,           box [Key("b")]),
 -                    (BooleanValue(true),box [Key("b"), Index(0)]),
 -                  (ListEnd,             box [Key("b")]),
 -                (ObjectEnd,             box []),
 +            vec![
 +                (ObjectStart,           vec![]),
 +                  (NumberValue(1.0),    vec![Key("a")]),
 +                  (ListStart,           vec![Key("b")]),
 +                    (BooleanValue(true),vec![Key("b"), Index(0)]),
 +                  (ListEnd,             vec![Key("b")]),
 +                (ObjectEnd,             vec![]),
              ]
          );
          assert_stream_equal(
                      { "c": {"d": null} }
                  ]
              }"#,
 -            ~[
 -                (ObjectStart,                   ~[]),
 -                  (NumberValue(1.0),            ~[Key("a")]),
 -                  (ListStart,                   ~[Key("b")]),
 -                    (BooleanValue(true),        ~[Key("b"), Index(0)]),
 -                    (StringValue("foo\nbar".to_string()),  ~[Key("b"), Index(1)]),
 -                    (ObjectStart,               ~[Key("b"), Index(2)]),
 -                      (ObjectStart,             ~[Key("b"), Index(2), Key("c")]),
 -                        (NullValue,             ~[Key("b"), Index(2), Key("c"), Key("d")]),
 -                      (ObjectEnd,               ~[Key("b"), Index(2), Key("c")]),
 -                    (ObjectEnd,                 ~[Key("b"), Index(2)]),
 -                  (ListEnd,                     ~[Key("b")]),
 -                (ObjectEnd,                     ~[]),
 +            vec![
 +                (ObjectStart,                   vec![]),
 +                  (NumberValue(1.0),            vec![Key("a")]),
 +                  (ListStart,                   vec![Key("b")]),
 +                    (BooleanValue(true),        vec![Key("b"), Index(0)]),
 +                    (StringValue("foo\nbar".to_string()),  vec![Key("b"), Index(1)]),
 +                    (ObjectStart,               vec![Key("b"), Index(2)]),
 +                      (ObjectStart,             vec![Key("b"), Index(2), Key("c")]),
 +                        (NullValue,             vec![Key("b"), Index(2), Key("c"), Key("d")]),
 +                      (ObjectEnd,               vec![Key("b"), Index(2), Key("c")]),
 +                    (ObjectEnd,                 vec![Key("b"), Index(2)]),
 +                  (ListEnd,                     vec![Key("b")]),
 +                (ObjectEnd,                     vec![]),
              ]
          );
      }
      fn test_read_list_streaming() {
          assert_stream_equal(
              "[]",
 -            box [
 -                (ListStart, box []),
 -                (ListEnd,   box []),
 +            vec![
 +                (ListStart, vec![]),
 +                (ListEnd,   vec![]),
              ]
          );
          assert_stream_equal(
              "[ ]",
 -            box [
 -                (ListStart, box []),
 -                (ListEnd,   box []),
 +            vec![
 +                (ListStart, vec![]),
 +                (ListEnd,   vec![]),
              ]
          );
          assert_stream_equal(
              "[true]",
 -            box [
 -                (ListStart,              box []),
 -                    (BooleanValue(true), box [Index(0)]),
 -                (ListEnd,                box []),
 +            vec![
 +                (ListStart,              vec![]),
 +                    (BooleanValue(true), vec![Index(0)]),
 +                (ListEnd,                vec![]),
              ]
          );
          assert_stream_equal(
              "[ false ]",
 -            box [
 -                (ListStart,               box []),
 -                    (BooleanValue(false), box [Index(0)]),
 -                (ListEnd,                 box []),
 +            vec![
 +                (ListStart,               vec![]),
 +                    (BooleanValue(false), vec![Index(0)]),
 +                (ListEnd,                 vec![]),
              ]
          );
          assert_stream_equal(
              "[null]",
 -            box [
 -                (ListStart,     box []),
 -                    (NullValue, box [Index(0)]),
 -                (ListEnd,       box []),
 +            vec![
 +                (ListStart,     vec![]),
 +                    (NullValue, vec![Index(0)]),
 +                (ListEnd,       vec![]),
              ]
          );
          assert_stream_equal(
              "[3, 1]",
 -            box [
 -                (ListStart,     box []),
 -                    (NumberValue(3.0), box [Index(0)]),
 -                    (NumberValue(1.0), box [Index(1)]),
 -                (ListEnd,       box []),
 +            vec![
 +                (ListStart,     vec![]),
 +                    (NumberValue(3.0), vec![Index(0)]),
 +                    (NumberValue(1.0), vec![Index(1)]),
 +                (ListEnd,       vec![]),
              ]
          );
          assert_stream_equal(
              "\n[3, 2]\n",
 -            box [
 -                (ListStart,     box []),
 -                    (NumberValue(3.0), box [Index(0)]),
 -                    (NumberValue(2.0), box [Index(1)]),
 -                (ListEnd,       box []),
 +            vec![
 +                (ListStart,     vec![]),
 +                    (NumberValue(3.0), vec![Index(0)]),
 +                    (NumberValue(2.0), vec![Index(1)]),
 +                (ListEnd,       vec![]),
              ]
          );
          assert_stream_equal(
              "[2, [4, 1]]",
 -            box [
 -                (ListStart,                 box []),
 -                    (NumberValue(2.0),      box [Index(0)]),
 -                    (ListStart,             box [Index(1)]),
 -                        (NumberValue(4.0),  box [Index(1), Index(0)]),
 -                        (NumberValue(1.0),  box [Index(1), Index(1)]),
 -                    (ListEnd,               box [Index(1)]),
 -                (ListEnd,                   box []),
 +            vec![
 +                (ListStart,                 vec![]),
 +                    (NumberValue(2.0),      vec![Index(0)]),
 +                    (ListStart,             vec![Index(1)]),
 +                        (NumberValue(4.0),  vec![Index(1), Index(0)]),
 +                        (NumberValue(1.0),  vec![Index(1), Index(1)]),
 +                    (ListEnd,               vec![Index(1)]),
 +                (ListEnd,                   vec![]),
              ]
          );
  
          assert_eq!((1, 2, 3).to_json(), list3);
          assert_eq!([1, 2].to_json(), list2);
          assert_eq!((&[1, 2, 3]).to_json(), list3);
 -        assert_eq!((~[1, 2]).to_json(), list2);
 +        assert_eq!((vec![1, 2]).to_json(), list2);
          assert_eq!(vec!(1, 2, 3).to_json(), list3);
          let mut tree_map = TreeMap::new();
          tree_map.insert("a".to_string(), 1);
index e3209c5c186477d5ee310f5f9b6a3c9e2744457f,5a1d60192fc24afe045441c506ddfae2f83d3479..b9bb0054d441a4216210956e032b0d2009ab259d
@@@ -21,7 -21,7 +21,7 @@@ use io::Writer
  use iter::{AdditiveIterator, DoubleEndedIterator, Extendable, Iterator, Map};
  use mem;
  use option::{Option, Some, None};
 -use slice::{Vector, OwnedVector, ImmutableVector};
 +use slice::{Vector, ImmutableVector};
  use str::{CharSplits, Str, StrAllocating, StrVector, StrSlice};
  use string::String;
  use vec::Vec;
@@@ -899,10 -899,16 +899,16 @@@ pub fn make_non_verbatim(path: &Path) -
              // \\?\D:\
              Path::new(repr.slice_from(4))
          }
+         #[cfg(stage0)]
          Some(VerbatimUNCPrefix(_,_)) => {
              // \\?\UNC\server\share
              Path::new(format!(r"\\{}", repr.slice_from(7)))
          }
+         #[cfg(not(stage0))]
+         Some(VerbatimUNCPrefix(_,_)) => {
+             // \\?\UNC\server\share
+             Path::new(format!(r"\{}", repr.slice_from(7)))
+         }
      };
      if new_path.prefix.is_none() {
          // \\?\UNC\server is a VerbatimUNCPrefix
index 4d9b112cb5c3a191e552ff3479e0d7fbefe9b60d,282f4065e4ff125fc5043140b18285364dfbe693..437b06e3df65b252f8d7a943d352ad6d2b82ec4d
@@@ -1208,11 -1208,18 +1208,18 @@@ impl<'a> Parser<'a> 
                  })
                }
  
+               #[cfg(stage0)]
                _ => {
                    let token_str = p.this_token_to_str();
                    p.fatal((format!("expected `;` or `\\{` but found `{}`",
                                     token_str)).as_slice())
                }
+               #[cfg(not(stage0))]
+               _ => {
+                   let token_str = p.this_token_to_str();
+                   p.fatal((format!("expected `;` or `{{` but found `{}`",
+                                    token_str)).as_slice())
+               }
              }
          })
      }
              // OWNED POINTER
              self.bump();
              match self.token {
 -                token::IDENT(ref ident, _)
 -                        if "str" == token::get_ident(*ident).get() => {
 -                    // This is OK (for now).
 -                }
 -                token::LBRACKET => {}   // Also OK.
 +                token::LBRACKET =>
 +                    self.obsolete(self.last_span, ObsoleteOwnedVector),
                  _ => self.obsolete(self.last_span, ObsoleteOwnedType),
              };
              TyUniq(self.parse_ty(false))
              hi = e.span.hi;
              // HACK: turn ~[...] into a ~-vec
              ex = match e.node {
 -              ExprVec(..) | ExprRepeat(..) => ExprVstore(e, ExprVstoreUniq),
 +              ExprVec(..) | ExprRepeat(..) => {
 +                  self.obsolete(self.last_span, ObsoleteOwnedVector);
 +                  ExprVstore(e, ExprVstoreUniq)
 +              }
                ExprLit(lit) if lit_is_str(lit) => {
                    self.obsolete(self.last_span, ObsoleteOwnedExpr);
                    ExprVstore(e, ExprVstoreUniq)
              // HACK: turn `box [...]` into a boxed-vec
              ex = match subexpression.node {
                  ExprVec(..) | ExprRepeat(..) => {
 +                    self.obsolete(self.last_span, ObsoleteOwnedVector);
                      ExprVstore(subexpression, ExprVstoreUniq)
                  }
                  ExprLit(lit) if lit_is_str(lit) => {
                  self.bump();
                  if self.token != token::RBRACE {
                      let token_str = self.this_token_to_str();
-                     self.fatal(format!("expected `\\}`, found `{}`",
+                     self.fatal(format!("expected `{}`, found `{}`", "}",
                                         token_str).as_slice())
                  }
                  etc = true;
              // consuming more tokens).
              let (bra, ket) = match token::close_delimiter_for(&self.token) {
                  Some(ket) => (self.token.clone(), ket),
+                 #[cfg(stage0)]
                  None      => {
                      // we only expect an ident if we didn't parse one
                      // above.
                                         ident_str,
                                         tok_str).as_slice())
                  }
+                 #[cfg(not(stage0))]
+                 None      => {
+                     // we only expect an ident if we didn't parse one
+                     // above.
+                     let ident_str = if id == token::special_idents::invalid {
+                         "identifier, "
+                     } else {
+                         ""
+                     };
+                     let tok_str = self.this_token_to_str();
+                     self.fatal(format!("expected {}`(` or `{{`, but found `{}`",
+                                        ident_str,
+                                        tok_str).as_slice())
+                 }
              };
  
              let tts = self.parse_unspanned_seq(
              fields = Vec::new();
          } else {
              let token_str = self.this_token_to_str();
-             self.fatal(format!("expected `\\{`, `(`, or `;` after struct \
-                                 name but found `{}`",
+             self.fatal(format!("expected `{}`, `(`, or `;` after struct \
+                                 name but found `{}`", "{",
                                 token_str).as_slice())
          }
  
                  self.bump();
              }
              token::RBRACE => {}
+             #[cfg(stage0)]
              _ => {
                  let token_str = self.this_token_to_str();
                  self.span_fatal(self.span,
                                  format!("expected `,`, or `\\}` but found `{}`",
                                          token_str).as_slice())
              }
+             #[cfg(not(stage0))]
+             _ => {
+                 let token_str = self.this_token_to_str();
+                 self.span_fatal(self.span,
+                                 format!("expected `,`, or `}}` but found `{}`",
+                                         token_str).as_slice())
+             }
          }
          a_var
      }
  
              let token_str = self.this_token_to_str();
              self.span_fatal(self.span,
-                             format!("expected `\\{` or `fn` but found `{}`",
+                             format!("expected `{}` or `fn` but found `{}`", "{",
                                      token_str).as_slice());
          }
  
diff --combined src/libtest/stats.rs
index aa0e9b46fa7c336cc34856455a66225f43010f52,d07e5662feb1c52582185b7db59c82c1a2680024..b0562c39dc28564fcede67e5d72b417b317ca84c
@@@ -167,6 -167,7 +167,6 @@@ impl<T: FloatMath + FromPrimitive> Summ
  impl<'a,T: FloatMath + FromPrimitive> Stats<T> for &'a [T] {
  
      // FIXME #11059 handle NaN, inf and overflow
 -    #[allow(deprecated_owned_vector)]
      fn sum(self) -> T {
          let mut partials = vec![];
  
@@@ -415,7 -416,7 +415,7 @@@ pub fn write_boxplot<T: Float + Show + 
          v = v + char_step;
          c += 1;
      }
-     try!(write!(w, r"\#"));
+     try!(write!(w, "#"));
      c += 1;
      while c < range_width && v < q3 {
          try!(write!(w, "*"));
@@@ -1026,6 -1027,7 +1026,6 @@@ mod tests 
  
      #[test]
      fn test_boxplot_nonpositive() {
 -        #[allow(deprecated_owned_vector)]
          fn t(s: &Summary<f64>, expected: String) {
              use std::io::MemWriter;
              let mut m = MemWriter::new();
index 7078518bebcf9598f2fe53691945b62cedb5f4d6,bf108dbe4d886b30a3a3fac9a83608c7950343d6..e00b3bb64bd3b1c57a19180662acee02f61d900a
@@@ -13,6 -13,7 +13,6 @@@
  #![feature(macro_rules, managed_boxes)]
  #![deny(warnings)]
  #![allow(unused_must_use)]
 -#![allow(deprecated_owned_vector)]
  
  extern crate debug;
  
@@@ -47,7 -48,7 +47,7 @@@ pub fn main() 
      // Various edge cases without formats
      t!(format!(""), "");
      t!(format!("hello"), "hello");
-     t!(format!("hello \\{"), "hello {");
+     t!(format!("hello {{"), "hello {");
  
      // default formatters should work
      t!(format!("{}", 1.0f32), "1");
      t!(format!("{foo_bar}", foo_bar=1), "1");
      t!(format!("{:d}", 5 + 5), "10");
  
-     // Methods should probably work
-     t!(format!("{0, plural, =1{a#} =2{b#} zero{c#} other{d#}}", 0u), "c0");
-     t!(format!("{0, plural, =1{a#} =2{b#} zero{c#} other{d#}}", 1u), "a1");
-     t!(format!("{0, plural, =1{a#} =2{b#} zero{c#} other{d#}}", 2u), "b2");
-     t!(format!("{0, plural, =1{a#} =2{b#} zero{c#} other{d#}}", 3u), "d3");
-     t!(format!("{0, select, a{a#} b{b#} c{c#} other{d#}}", "a"), "aa");
-     t!(format!("{0, select, a{a#} b{b#} c{c#} other{d#}}", "b"), "bb");
-     t!(format!("{0, select, a{a#} b{b#} c{c#} other{d#}}", "c"), "cc");
-     t!(format!("{0, select, a{a#} b{b#} c{c#} other{d#}}", "d"), "dd");
-     t!(format!("{1, select, a{#{0:s}} other{#}}", "b", "a"), "ab");
-     t!(format!("{1, select, a{#{0}} other{#}}", "c", "b"), "b");
      // Formatting strings and their arguments
      t!(format!("{:s}", "a"), "a");
      t!(format!("{:4s}", "a"), "a   ");
      t!(format!("{:+10.3e}", -1.2345e6f64), "  -1.234e6");
  
      // Escaping
-     t!(format!("\\{"), "{");
-     t!(format!("\\}"), "}");
-     t!(format!("\\#"), "#");
-     t!(format!("\\\\"), "\\");
+     t!(format!("{{"), "{");
+     t!(format!("}}"), "}");
  
      test_write();
      test_print();