]> git.lizzy.rs Git - rust.git/commitdiff
Round 3 test fixes and conflicts
authorAlex Crichton <alex@alexcrichton.com>
Wed, 18 Feb 2015 23:58:07 +0000 (15:58 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Thu, 19 Feb 2015 00:34:04 +0000 (16:34 -0800)
28 files changed:
src/libcore/array.rs
src/libcore/hash/mod.rs
src/libcore/marker.rs
src/libgraphviz/lib.rs
src/libsyntax/diagnostic.rs
src/libsyntax/ext/source_util.rs
src/libsyntax/ext/tt/macro_parser.rs
src/libsyntax/ext/tt/macro_rules.rs
src/libsyntax/ext/tt/transcribe.rs
src/libsyntax/parse/lexer/mod.rs
src/libsyntax/parse/parser.rs
src/libsyntax/print/pp.rs
src/libsyntax/print/pprust.rs
src/libsyntax/test.rs
src/libsyntax/util/interner.rs
src/test/compile-fail/cross-borrow-trait.rs
src/test/compile-fail/destructure-trait-ref.rs
src/test/compile-fail/dst-bad-coerce1.rs
src/test/compile-fail/dst-bad-coerce3.rs
src/test/compile-fail/dst-object-from-unsized-type.rs
src/test/compile-fail/issue-5543.rs
src/test/compile-fail/kindck-inherited-copy-bound.rs
src/test/compile-fail/regions-close-object-into-object-5.rs
src/test/compile-fail/regions-close-param-into-object.rs
src/test/run-pass/borrowck-trait-lifetime.rs
src/test/run-pass/issue-14399.rs
src/test/run-pass/trait-impl.rs
src/test/run-pass/unique-object-move.rs

index 0c563f60c13bae6b2ad627643f7a1d5f964efbb7..afb5d95c9f8d79219b122a529749d35a35ceafab 100644 (file)
@@ -45,7 +45,7 @@ fn hash(&self, state: &mut S) {
             #[stable(feature = "rust1", since = "1.0.0")]
             impl<T: Hash> Hash for [T; $N] {
                 fn hash<H: hash::Hasher>(&self, state: &mut H) {
-                    Hash::hash(&self[], state)
+                    Hash::hash(&self[..], state)
                 }
             }
 
index 1bd8aa0a17ecc6ee43140b81d096350fca7523d7..1086ae84ded6d96359c3e6cbccf0a1d7ef596237 100644 (file)
@@ -494,13 +494,4 @@ fn hash<H: Hasher>(&self, state: &mut H) {
             state.write_usize(*self as usize)
         }
     }
-
-    #[stable(feature = "rust1", since = "1.0.0")]
-    impl<'a, T, B: ?Sized> Hash for Cow<'a, T, B>
-        where B: Hash + ToOwned<T>
-    {
-        fn hash<H: Hasher>(&self, state: &mut H) {
-            Hash::hash(&**self, state)
-        }
-    }
 }
index dc792a3f47f60c98f693488ede491b72f7e85cf6..dbe6db86adab560f4f8a90f5331ad1804c635d8a 100644 (file)
@@ -233,11 +233,18 @@ pub unsafe trait Sync : MarkerTrait {
 
 macro_rules! impls{
     ($t: ident) => (
+        #[cfg(stage0)]
         impl<T:?Sized, S: Hasher> Hash<S> for $t<T> {
             #[inline]
             fn hash(&self, _: &mut S) {
             }
         }
+        #[cfg(not(stage0))]
+        impl<T:?Sized> Hash for $t<T> {
+            #[inline]
+            fn hash<H: Hasher>(&self, _: &mut H) {
+            }
+        }
 
         impl<T:?Sized> cmp::PartialEq for $t<T> {
             fn eq(&self, _other: &$t<T>) -> bool {
index 3d594378f558679680dc3df9d3a7fc93528f0526..acd52c752e8aa1b29e79505937f332cc2f311dcb 100644 (file)
        html_root_url = "http://doc.rust-lang.org/nightly/")]
 #![feature(int_uint)]
 #![feature(collections)]
-#![feature(core)]
 #![feature(old_io)]
 
 use self::LabelText::*;
 
-use std::borrow::IntoCow;
+use std::borrow::{IntoCow, Cow};
 use std::old_io;
-use std::string::CowString;
-use std::vec::CowVec;
 
 /// The text for a graphviz label on a node or edge.
 pub enum LabelText<'a> {
@@ -291,7 +288,7 @@ pub enum LabelText<'a> {
     ///
     /// Occurrences of backslashes (`\`) are escaped, and thus appear
     /// as backslashes in the rendered label.
-    LabelStr(CowString<'a>),
+    LabelStr(Cow<'a, str>),
 
     /// This kind of label uses the graphviz label escString type:
     /// http://www.graphviz.org/content/attrs#kescString
@@ -303,7 +300,7 @@ pub enum LabelText<'a> {
     /// to break a line (centering the line preceding the `\n`), there
     /// are also the escape sequences `\l` which left-justifies the
     /// preceding line and `\r` which right-justifies it.
-    EscStr(CowString<'a>),
+    EscStr(Cow<'a, str>),
 }
 
 // There is a tension in the design of the labelling API.
@@ -340,7 +337,7 @@ pub enum LabelText<'a> {
 
 /// `Id` is a Graphviz `ID`.
 pub struct Id<'a> {
-    name: CowString<'a>,
+    name: Cow<'a, str>,
 }
 
 impl<'a> Id<'a> {
@@ -387,7 +384,7 @@ pub fn as_slice(&'a self) -> &'a str {
         &*self.name
     }
 
-    pub fn name(self) -> CowString<'a> {
+    pub fn name(self) -> Cow<'a, str> {
         self.name
     }
 }
@@ -463,7 +460,7 @@ pub fn escape(&self) -> String {
     /// yields same content as self.  The result obeys the law
     /// render(`lt`) == render(`EscStr(lt.pre_escaped_content())`) for
     /// all `lt: LabelText`.
-    fn pre_escaped_content(self) -> CowString<'a> {
+    fn pre_escaped_content(self) -> Cow<'a, str> {
         match self {
             EscStr(s) => s,
             LabelStr(s) => if s.contains_char('\\') {
@@ -489,8 +486,8 @@ pub fn suffix_line(self, suffix: LabelText) -> LabelText<'static> {
     }
 }
 
-pub type Nodes<'a,N> = CowVec<'a,N>;
-pub type Edges<'a,E> = CowVec<'a,E>;
+pub type Nodes<'a,N> = Cow<'a,[N]>;
+pub type Edges<'a,E> = Cow<'a,[E]>;
 
 // (The type parameters in GraphWalk should be associated items,
 // when/if Rust supports such.)
index 02643fae9a1673691443a214695be2aff9fbfad3..27219774cf148c52f68f8e009fc8d7130691fdd8 100644 (file)
@@ -311,16 +311,16 @@ fn print_diagnostic(dst: &mut EmitterWriter, topic: &str, lvl: Level,
     }
 
     try!(print_maybe_styled(dst,
-                            &format!("{}: ", lvl.to_string())[],
+                            &format!("{}: ", lvl.to_string()),
                             term::attr::ForegroundColor(lvl.color())));
     try!(print_maybe_styled(dst,
-                            &format!("{}", msg)[],
+                            &format!("{}", msg),
                             term::attr::Bold));
 
     match code {
         Some(code) => {
             let style = term::attr::ForegroundColor(term::color::BRIGHT_MAGENTA);
-            try!(print_maybe_styled(dst, &format!(" [{}]", code.clone())[], style));
+            try!(print_maybe_styled(dst, &format!(" [{}]", code.clone()), style));
         }
         None => ()
     }
@@ -438,7 +438,7 @@ fn emit(dst: &mut EmitterWriter, cm: &codemap::CodeMap, rsp: RenderSpan,
                 Some(_) => {
                     try!(print_diagnostic(dst, &ss[..], Help,
                                           &format!("pass `--explain {}` to see a detailed \
-                                                   explanation", code)[], None));
+                                                   explanation", code), None));
                 }
                 None => ()
             },
@@ -542,7 +542,7 @@ fn highlight_lines(err: &mut EmitterWriter,
             }
 
             try!(print_maybe_styled(err,
-                                    &format!("{}\n", s)[],
+                                    &format!("{}\n", s),
                                     term::attr::ForegroundColor(lvl.color())));
         }
     }
index 22fac22c9cc5213717fee9ce30774a85a9355ff6..c8d48750c75093259d428d491914075dd202b827 100644 (file)
@@ -117,7 +117,7 @@ fn make_items(mut self: Box<ExpandResult<'a>>)
                     None => self.p.span_fatal(
                         self.p.span,
                         &format!("expected item, found `{}`",
-                                 self.p.this_token_to_string())[]
+                                 self.p.this_token_to_string())
                     )
                 }
             }
@@ -141,7 +141,7 @@ pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
             cx.span_err(sp,
                         &format!("couldn't read {}: {}",
                                 file.display(),
-                                e)[]);
+                                e));
             return DummyResult::expr(sp);
         }
         Ok(bytes) => bytes,
@@ -159,7 +159,7 @@ pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
         Err(_) => {
             cx.span_err(sp,
                         &format!("{} wasn't a utf-8 file",
-                                file.display())[]);
+                                file.display()));
             return DummyResult::expr(sp);
         }
     }
@@ -175,7 +175,7 @@ pub fn expand_include_bytes(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
     match File::open(&file).read_to_end() {
         Err(e) => {
             cx.span_err(sp,
-                        &format!("couldn't read {}: {}", file.display(), e)[]);
+                        &format!("couldn't read {}: {}", file.display(), e));
             return DummyResult::expr(sp);
         }
         Ok(bytes) => {
index dca734e1f5e8970c157446ad646ec67bbe113973..664f7b3e088480e2a55ef7e6a93cba00eab2a9f1 100644 (file)
@@ -229,7 +229,7 @@ fn n_rec(p_s: &ParseSess, m: &TokenTree, res: &[Rc<NamedMatch>],
                         p_s.span_diagnostic
                            .span_fatal(sp,
                                        &format!("duplicated bind name: {}",
-                                               &string)[])
+                                               &string))
                     }
                 }
             }
@@ -533,7 +533,7 @@ pub fn parse_nt(p: &mut Parser, sp: Span, name: &str) -> Nonterminal {
         _ => {
             let token_str = pprust::token_to_string(&p.token);
             p.fatal(&format!("expected ident, found {}",
-                             &token_str[..])[])
+                             &token_str[..]))
         }
       },
       "path" => {
@@ -542,7 +542,7 @@ pub fn parse_nt(p: &mut Parser, sp: Span, name: &str) -> Nonterminal {
       "meta" => token::NtMeta(p.parse_meta_item()),
       _ => {
           p.span_fatal_help(sp,
-                            &format!("invalid fragment specifier `{}`", name)[],
+                            &format!("invalid fragment specifier `{}`", name),
                             "valid fragment specifiers are `ident`, `block`, \
                              `stmt`, `expr`, `pat`, `ty`, `path`, `meta`, `tt` \
                              and `item`")
index 624cb9ddf4256f345931ce665b09caceaeb75147..fa6d934a4575581561476a177af7bb8872cdf195 100644 (file)
@@ -123,8 +123,8 @@ fn expand<'cx>(&self,
                           self.name,
                           self.imported_from,
                           arg,
-                          &self.lhses[],
-                          &self.rhses[])
+                          &self.lhses,
+                          &self.rhses)
     }
 }
 
@@ -151,7 +151,7 @@ fn generic_extension<'cx>(cx: &'cx ExtCtxt,
         match **lhs {
           MatchedNonterminal(NtTT(ref lhs_tt)) => {
             let lhs_tt = match **lhs_tt {
-                TtDelimited(_, ref delim) => &delim.tts[],
+                TtDelimited(_, ref delim) => &delim.tts[..],
                 _ => cx.span_fatal(sp, "malformed macro lhs")
             };
             // `None` is because we're not interpolating
index 17016f3ac11794519cf240f60d929fc7a595b84b..0d92bd761b418e28e4ecd2d17817a983245a660e 100644 (file)
@@ -309,7 +309,7 @@ pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan {
                                 r.sp_diag.span_fatal(
                                     r.cur_span, /* blame the macro writer */
                                     &format!("variable '{:?}' is still repeating at this depth",
-                                            token::get_ident(ident))[]);
+                                            token::get_ident(ident)));
                             }
                         }
                     }
index cca641a7852f45b84ace9f609fbe760563c2a840..fd08cbd161bfe3db302137e480539c2b3de8d6ff 100644 (file)
 use parse::token;
 use parse::token::{str_to_ident};
 
-use std::borrow::IntoCow;
+use std::borrow::{IntoCow, Cow};
 use std::char;
 use std::fmt;
 use std::mem::replace;
 use std::num;
 use std::rc::Rc;
 use std::str;
-use std::string::CowString;
 
 pub use ext::tt::transcribe::{TtReader, new_tt_reader, new_tt_reader_with_doc_flag};
 
@@ -278,7 +277,7 @@ fn with_str_from_to<T, F>(&self, start: BytePos, end: BytePos, f: F) -> T where
 
     /// Converts CRLF to LF in the given string, raising an error on bare CR.
     fn translate_crlf<'b>(&self, start: BytePos,
-                          s: &'b str, errmsg: &'b str) -> CowString<'b> {
+                          s: &'b str, errmsg: &'b str) -> Cow<'b, str> {
         let mut i = 0;
         while i < s.len() {
             let str::CharRange { ch, next } = s.char_range_at(i);
index e272c770cb7a3ec6e156c42eba52099eb8c1d346..370201e53825efef69f01d9c7313127f3a436cef 100644 (file)
@@ -4401,7 +4401,7 @@ fn expect_self_type_ident(&mut self) -> ast::Ident {
             _ => {
                 let token_str = self.this_token_to_string();
                 self.fatal(&format!("expected `Self`, found `{}`",
-                                   token_str)[])
+                                   token_str))
             }
         }
     }
@@ -4536,7 +4536,7 @@ macro_rules! parse_remaining_arguments {
                 _ => {
                     let token_str = self.this_token_to_string();
                     self.fatal(&format!("expected `,` or `)`, found `{}`",
-                                       token_str)[])
+                                       token_str))
                 }
             }
             }
@@ -4939,7 +4939,7 @@ pub fn parse_record_struct_body(&mut self, class_name: &ast::Ident) -> Vec<Struc
             if fields.len() == 0 {
                 self.fatal(&format!("unit-like struct definition should be \
                     written as `struct {};`",
-                    token::get_ident(class_name.clone()))[]);
+                    token::get_ident(class_name.clone())));
             }
 
             self.bump();
@@ -4947,7 +4947,7 @@ pub fn parse_record_struct_body(&mut self, class_name: &ast::Ident) -> Vec<Struc
             let token_str = self.this_token_to_string();
             self.fatal(&format!("expected `where`, or `{}` after struct \
                                 name, found `{}`", "{",
-                                token_str)[]);
+                                token_str));
         }
 
         fields
@@ -4978,7 +4978,7 @@ pub fn parse_tuple_struct_body(&mut self,
             if fields.len() == 0 {
                 self.fatal(&format!("unit-like struct definition should be \
                     written as `struct {};`",
-                    token::get_ident(class_name.clone()))[]);
+                    token::get_ident(class_name.clone())));
             }
 
             self.parse_where_clause(generics);
@@ -4993,7 +4993,7 @@ pub fn parse_tuple_struct_body(&mut self,
         } else {
             let token_str = self.this_token_to_string();
             self.fatal(&format!("expected `where`, `{}`, `(`, or `;` after struct \
-                name, found `{}`", "{", token_str)[]);
+                name, found `{}`", "{", token_str));
         }
     }
 
@@ -5013,7 +5013,7 @@ pub fn parse_single_struct_field(&mut self,
                 let token_str = self.this_token_to_string();
                 self.span_fatal_help(span,
                                      &format!("expected `,`, or `}}`, found `{}`",
-                                             token_str)[],
+                                             token_str),
                                      "struct fields should be separated by commas")
             }
         }
@@ -5085,7 +5085,7 @@ fn parse_mod_items(&mut self,
         // Parse all of the items up to closing or an attribute.
 
         let mut attrs = first_item_attrs;
-        attrs.push_all(&self.parse_outer_attributes()[]);
+        attrs.push_all(&self.parse_outer_attributes());
         let mut items = vec![];
 
         loop {
@@ -5105,14 +5105,14 @@ fn parse_mod_items(&mut self,
 
         while self.token != term {
             let mut attrs = mem::replace(&mut attrs, vec![]);
-            attrs.push_all(&self.parse_outer_attributes()[]);
+            attrs.push_all(&self.parse_outer_attributes());
             debug!("parse_mod_items: parse_item_(attrs={:?})", attrs);
             match self.parse_item_(attrs, true /* macros allowed */) {
               Ok(item) => items.push(item),
               Err(_) => {
                   let token_str = self.this_token_to_string();
                   self.fatal(&format!("expected item, found `{}`",
-                                     token_str)[])
+                                     token_str))
               }
             }
         }
@@ -5216,13 +5216,13 @@ fn eval_src_mod(&mut self,
                                    &format!("maybe move this module `{0}` \
                                             to its own directory via \
                                             `{0}/mod.rs`",
-                                           this_module)[]);
+                                           this_module));
                     if default_exists || secondary_exists {
                         self.span_note(id_sp,
                                        &format!("... or maybe `use` the module \
                                                 `{}` instead of possibly \
                                                 redeclaring it",
-                                               mod_name)[]);
+                                               mod_name));
                     }
                     self.abort_if_errors();
                 }
@@ -5233,12 +5233,12 @@ fn eval_src_mod(&mut self,
                     (false, false) => {
                         self.span_fatal_help(id_sp,
                                              &format!("file not found for module `{}`",
-                                                     mod_name)[],
+                                                     mod_name),
                                              &format!("name the file either {} or {} inside \
                                                      the directory {:?}",
                                                      default_path_str,
                                                      secondary_path_str,
-                                                     dir_path.display())[]);
+                                                     dir_path.display()));
                     }
                     (true, true) => {
                         self.span_fatal_help(
@@ -5247,7 +5247,7 @@ fn eval_src_mod(&mut self,
                                      and {}",
                                     mod_name,
                                     default_path_str,
-                                    secondary_path_str)[],
+                                    secondary_path_str),
                             "delete or rename one of them to remove the ambiguity");
                     }
                 }
@@ -5269,10 +5269,10 @@ fn eval_src_mod_from_path(&mut self,
                 let mut err = String::from_str("circular modules: ");
                 let len = included_mod_stack.len();
                 for p in &included_mod_stack[i.. len] {
-                    err.push_str(&p.display().as_cow()[]);
+                    err.push_str(&p.display().as_cow());
                     err.push_str(" -> ");
                 }
-                err.push_str(&path.display().as_cow()[]);
+                err.push_str(&path.display().as_cow());
                 self.span_fatal(id_sp, &err[..]);
             }
             None => ()
@@ -5378,7 +5378,7 @@ fn parse_item_extern_crate(&mut self,
                     self.span_help(span,
                                    &format!("perhaps you meant to enclose the crate name `{}` in \
                                            a string?",
-                                          the_ident.as_str())[]);
+                                          the_ident.as_str()));
                     None
                 } else {
                     None
@@ -5404,7 +5404,7 @@ fn parse_item_extern_crate(&mut self,
                 self.span_fatal(span,
                                 &format!("expected extern crate name but \
                                          found `{}`",
-                                        token_str)[]);
+                                        token_str));
             }
         };
 
@@ -5502,7 +5502,7 @@ fn parse_enum_def(&mut self, _generics: &ast::Generics) -> EnumDef {
                     self.span_err(start_span,
                         &format!("unit-like struct variant should be written \
                                  without braces, as `{},`",
-                                token::get_ident(ident))[]);
+                                token::get_ident(ident)));
                 }
                 kind = StructVariantKind(struct_def);
             } else if self.check(&token::OpenDelim(token::Paren)) {
@@ -5580,7 +5580,7 @@ fn parse_opt_abi(&mut self) -> Option<abi::Abi> {
                             &format!("illegal ABI: expected one of [{}], \
                                      found `{}`",
                                     abi::all_names().connect(", "),
-                                    the_string)[]);
+                                    the_string));
                         None
                     }
                 }
@@ -5660,7 +5660,7 @@ fn parse_item_(&mut self, attrs: Vec<Attribute>,
             let token_str = self.this_token_to_string();
             self.span_fatal(span,
                             &format!("expected `{}` or `fn`, found `{}`", "{",
-                                    token_str)[]);
+                                    token_str));
         }
 
         if self.eat_keyword_noexpect(keywords::Virtual) {
@@ -6054,7 +6054,7 @@ fn parse_view_path(&mut self) -> P<ViewPath> {
     fn parse_foreign_items(&mut self, first_item_attrs: Vec<Attribute>)
                            -> Vec<P<ForeignItem>> {
         let mut attrs = first_item_attrs;
-        attrs.push_all(&self.parse_outer_attributes()[]);
+        attrs.push_all(&self.parse_outer_attributes());
         let mut foreign_items = Vec::new();
         loop {
             match self.parse_foreign_item(attrs) {
index 360178ac7281b201f28b4aa0ebbcb53f18bbf769..1593bfb97fe1da755ff08f1697d05c65e85d9eb1 100644 (file)
@@ -539,8 +539,8 @@ pub fn print_str(&mut self, s: &str) -> old_io::IoResult<()> {
     pub fn print(&mut self, token: Token, l: isize) -> old_io::IoResult<()> {
         debug!("print {} {} (remaining line space={})", tok_str(&token), l,
                self.space);
-        debug!("{}", buf_str(&self.token[],
-                             &self.size[],
+        debug!("{}", buf_str(&self.token,
+                             &self.size,
                              self.left,
                              self.right,
                              6));
index e2c7e992675dc1321083fe1f94503c430ac85310..f26578e740120d8f33695834534ac2a6c6d15d1d 100644 (file)
@@ -134,7 +134,7 @@ pub fn print_crate<'a>(cm: &'a CodeMap,
         try!(s.print_attribute(&fake_attr));
     }
 
-    try!(s.print_mod(&krate.module, &krate.attrs[]));
+    try!(s.print_mod(&krate.module, &krate.attrs));
     try!(s.print_remaining_comments());
     eof(&mut s.s)
 }
@@ -765,7 +765,7 @@ pub fn print_foreign_item(&mut self,
                               item: &ast::ForeignItem) -> IoResult<()> {
         try!(self.hardbreak_if_not_bol());
         try!(self.maybe_print_comment(item.span.lo));
-        try!(self.print_outer_attributes(&item.attrs[]));
+        try!(self.print_outer_attributes(&item.attrs));
         match item.node {
             ast::ForeignItemFn(ref decl, ref generics) => {
                 try!(self.print_fn(&**decl, None, abi::Rust, item.ident, generics,
@@ -776,7 +776,7 @@ pub fn print_foreign_item(&mut self,
             }
             ast::ForeignItemStatic(ref t, m) => {
                 try!(self.head(&visibility_qualified(item.vis,
-                                                    "static")[]));
+                                                    "static")));
                 if m {
                     try!(self.word_space("mut"));
                 }
@@ -793,7 +793,7 @@ pub fn print_foreign_item(&mut self,
     fn print_associated_type(&mut self, typedef: &ast::AssociatedType)
                              -> IoResult<()>
     {
-        try!(self.print_outer_attributes(&typedef.attrs[]));
+        try!(self.print_outer_attributes(&typedef.attrs));
         try!(self.word_space("type"));
         try!(self.print_ty_param(&typedef.ty_param));
         word(&mut self.s, ";")
@@ -812,12 +812,12 @@ fn print_typedef(&mut self, typedef: &ast::Typedef) -> IoResult<()> {
     pub fn print_item(&mut self, item: &ast::Item) -> IoResult<()> {
         try!(self.hardbreak_if_not_bol());
         try!(self.maybe_print_comment(item.span.lo));
-        try!(self.print_outer_attributes(&item.attrs[]));
+        try!(self.print_outer_attributes(&item.attrs));
         try!(self.ann.pre(self, NodeItem(item)));
         match item.node {
             ast::ItemExternCrate(ref optional_path) => {
                 try!(self.head(&visibility_qualified(item.vis,
-                                                     "extern crate")[]));
+                                                     "extern crate")));
                 if let Some((ref p, style)) = *optional_path {
                     try!(self.print_string(p, style));
                     try!(space(&mut self.s));
@@ -831,7 +831,7 @@ pub fn print_item(&mut self, item: &ast::Item) -> IoResult<()> {
             }
             ast::ItemUse(ref vp) => {
                 try!(self.head(&visibility_qualified(item.vis,
-                                                     "use")[]));
+                                                     "use")));
                 try!(self.print_view_path(&**vp));
                 try!(word(&mut self.s, ";"));
                 try!(self.end()); // end inner head-block
@@ -839,7 +839,7 @@ pub fn print_item(&mut self, item: &ast::Item) -> IoResult<()> {
             }
             ast::ItemStatic(ref ty, m, ref expr) => {
                 try!(self.head(&visibility_qualified(item.vis,
-                                                    "static")[]));
+                                                    "static")));
                 if m == ast::MutMutable {
                     try!(self.word_space("mut"));
                 }
@@ -856,7 +856,7 @@ pub fn print_item(&mut self, item: &ast::Item) -> IoResult<()> {
             }
             ast::ItemConst(ref ty, ref expr) => {
                 try!(self.head(&visibility_qualified(item.vis,
-                                                    "const")[]));
+                                                    "const")));
                 try!(self.print_ident(item.ident));
                 try!(self.word_space(":"));
                 try!(self.print_type(&**ty));
@@ -879,28 +879,28 @@ pub fn print_item(&mut self, item: &ast::Item) -> IoResult<()> {
                     item.vis
                 ));
                 try!(word(&mut self.s, " "));
-                try!(self.print_block_with_attrs(&**body, &item.attrs[]));
+                try!(self.print_block_with_attrs(&**body, &item.attrs));
             }
             ast::ItemMod(ref _mod) => {
                 try!(self.head(&visibility_qualified(item.vis,
-                                                    "mod")[]));
+                                                    "mod")));
                 try!(self.print_ident(item.ident));
                 try!(self.nbsp());
                 try!(self.bopen());
-                try!(self.print_mod(_mod, &item.attrs[]));
+                try!(self.print_mod(_mod, &item.attrs));
                 try!(self.bclose(item.span));
             }
             ast::ItemForeignMod(ref nmod) => {
                 try!(self.head("extern"));
-                try!(self.word_nbsp(&nmod.abi.to_string()[]));
+                try!(self.word_nbsp(&nmod.abi.to_string()));
                 try!(self.bopen());
-                try!(self.print_foreign_mod(nmod, &item.attrs[]));
+                try!(self.print_foreign_mod(nmod, &item.attrs));
                 try!(self.bclose(item.span));
             }
             ast::ItemTy(ref ty, ref params) => {
                 try!(self.ibox(indent_unit));
                 try!(self.ibox(0));
-                try!(self.word_nbsp(&visibility_qualified(item.vis, "type")[]));
+                try!(self.word_nbsp(&visibility_qualified(item.vis, "type")));
                 try!(self.print_ident(item.ident));
                 try!(self.print_generics(params));
                 try!(self.end()); // end the inner ibox
@@ -922,7 +922,7 @@ pub fn print_item(&mut self, item: &ast::Item) -> IoResult<()> {
                 ));
             }
             ast::ItemStruct(ref struct_def, ref generics) => {
-                try!(self.head(&visibility_qualified(item.vis,"struct")[]));
+                try!(self.head(&visibility_qualified(item.vis,"struct")));
                 try!(self.print_struct(&**struct_def, generics, item.ident, item.span));
             }
 
@@ -963,7 +963,7 @@ pub fn print_item(&mut self, item: &ast::Item) -> IoResult<()> {
 
                 try!(space(&mut self.s));
                 try!(self.bopen());
-                try!(self.print_inner_attributes(&item.attrs[]));
+                try!(self.print_inner_attributes(&item.attrs));
                 for impl_item in impl_items {
                     match *impl_item {
                         ast::MethodImplItem(ref meth) => {
@@ -1049,12 +1049,12 @@ pub fn print_enum_def(&mut self, enum_definition: &ast::EnumDef,
                           generics: &ast::Generics, ident: ast::Ident,
                           span: codemap::Span,
                           visibility: ast::Visibility) -> IoResult<()> {
-        try!(self.head(&visibility_qualified(visibility, "enum")[]));
+        try!(self.head(&visibility_qualified(visibility, "enum")));
         try!(self.print_ident(ident));
         try!(self.print_generics(generics));
         try!(self.print_where_clause(generics));
         try!(space(&mut self.s));
-        self.print_variants(&enum_definition.variants[], span)
+        self.print_variants(&enum_definition.variants, span)
     }
 
     pub fn print_variants(&mut self,
@@ -1064,7 +1064,7 @@ pub fn print_variants(&mut self,
         for v in variants {
             try!(self.space_if_not_bol());
             try!(self.maybe_print_comment(v.span.lo));
-            try!(self.print_outer_attributes(&v.node.attrs[]));
+            try!(self.print_outer_attributes(&v.node.attrs));
             try!(self.ibox(indent_unit));
             try!(self.print_variant(&**v));
             try!(word(&mut self.s, ","));
@@ -1092,7 +1092,7 @@ pub fn print_struct(&mut self,
             if !struct_def.fields.is_empty() {
                 try!(self.popen());
                 try!(self.commasep(
-                    Inconsistent, &struct_def.fields[],
+                    Inconsistent, &struct_def.fields,
                     |s, field| {
                         match field.node.kind {
                             ast::NamedField(..) => panic!("unexpected named field"),
@@ -1122,7 +1122,7 @@ pub fn print_struct(&mut self,
                     ast::NamedField(ident, visibility) => {
                         try!(self.hardbreak_if_not_bol());
                         try!(self.maybe_print_comment(field.span.lo));
-                        try!(self.print_outer_attributes(&field.node.attrs[]));
+                        try!(self.print_outer_attributes(&field.node.attrs));
                         try!(self.print_visibility(visibility));
                         try!(self.print_ident(ident));
                         try!(self.word_nbsp(":"));
@@ -1146,7 +1146,7 @@ pub fn print_struct(&mut self,
     pub fn print_tt(&mut self, tt: &ast::TokenTree) -> IoResult<()> {
         match *tt {
             ast::TtToken(_, ref tk) => {
-                try!(word(&mut self.s, &token_to_string(tk)[]));
+                try!(word(&mut self.s, &token_to_string(tk)));
                 match *tk {
                     parse::token::DocComment(..) => {
                         hardbreak(&mut self.s)
@@ -1155,11 +1155,11 @@ pub fn print_tt(&mut self, tt: &ast::TokenTree) -> IoResult<()> {
                 }
             }
             ast::TtDelimited(_, ref delimed) => {
-                try!(word(&mut self.s, &token_to_string(&delimed.open_token())[]));
+                try!(word(&mut self.s, &token_to_string(&delimed.open_token())));
                 try!(space(&mut self.s));
-                try!(self.print_tts(&delimed.tts[]));
+                try!(self.print_tts(&delimed.tts));
                 try!(space(&mut self.s));
-                word(&mut self.s, &token_to_string(&delimed.close_token())[])
+                word(&mut self.s, &token_to_string(&delimed.close_token()))
             },
             ast::TtSequence(_, ref seq) => {
                 try!(word(&mut self.s, "$("));
@@ -1169,7 +1169,7 @@ pub fn print_tt(&mut self, tt: &ast::TokenTree) -> IoResult<()> {
                 try!(word(&mut self.s, ")"));
                 match seq.separator {
                     Some(ref tk) => {
-                        try!(word(&mut self.s, &token_to_string(tk)[]));
+                        try!(word(&mut self.s, &token_to_string(tk)));
                     }
                     None => {},
                 }
@@ -1233,7 +1233,7 @@ pub fn print_variant(&mut self, v: &ast::Variant) -> IoResult<()> {
     pub fn print_ty_method(&mut self, m: &ast::TypeMethod) -> IoResult<()> {
         try!(self.hardbreak_if_not_bol());
         try!(self.maybe_print_comment(m.span.lo));
-        try!(self.print_outer_attributes(&m.attrs[]));
+        try!(self.print_outer_attributes(&m.attrs));
         try!(self.print_ty_fn(m.abi,
                               m.unsafety,
                               &*m.decl,
@@ -1262,7 +1262,7 @@ pub fn print_impl_item(&mut self, ii: &ast::ImplItem) -> IoResult<()> {
     pub fn print_method(&mut self, meth: &ast::Method) -> IoResult<()> {
         try!(self.hardbreak_if_not_bol());
         try!(self.maybe_print_comment(meth.span.lo));
-        try!(self.print_outer_attributes(&meth.attrs[]));
+        try!(self.print_outer_attributes(&meth.attrs));
         match meth.node {
             ast::MethDecl(ident,
                           ref generics,
@@ -1280,7 +1280,7 @@ pub fn print_method(&mut self, meth: &ast::Method) -> IoResult<()> {
                                    Some(&explicit_self.node),
                                    vis));
                 try!(word(&mut self.s, " "));
-                self.print_block_with_attrs(&**body, &meth.attrs[])
+                self.print_block_with_attrs(&**body, &meth.attrs)
             },
             ast::MethMac(codemap::Spanned { node: ast::MacInvocTT(ref pth, ref tts, _),
                                             ..}) => {
@@ -1874,11 +1874,11 @@ pub fn print_expr(&mut self, expr: &ast::Expr) -> IoResult<()> {
                 try!(self.print_string(&a.asm, a.asm_str_style));
                 try!(self.word_space(":"));
 
-                try!(self.commasep(Inconsistent, &a.outputs[],
+                try!(self.commasep(Inconsistent, &a.outputs,
                                    |s, &(ref co, ref o, is_rw)| {
                     match co.slice_shift_char() {
                         Some(('=', operand)) if is_rw => {
-                            try!(s.print_string(&format!("+{}", operand)[],
+                            try!(s.print_string(&format!("+{}", operand),
                                                 ast::CookedStr))
                         }
                         _ => try!(s.print_string(&co, ast::CookedStr))
@@ -1891,7 +1891,7 @@ pub fn print_expr(&mut self, expr: &ast::Expr) -> IoResult<()> {
                 try!(space(&mut self.s));
                 try!(self.word_space(":"));
 
-                try!(self.commasep(Inconsistent, &a.inputs[],
+                try!(self.commasep(Inconsistent, &a.inputs,
                                    |s, &(ref co, ref o)| {
                     try!(s.print_string(&co, ast::CookedStr));
                     try!(s.popen());
@@ -1902,7 +1902,7 @@ pub fn print_expr(&mut self, expr: &ast::Expr) -> IoResult<()> {
                 try!(space(&mut self.s));
                 try!(self.word_space(":"));
 
-                try!(self.commasep(Inconsistent, &a.clobbers[],
+                try!(self.commasep(Inconsistent, &a.clobbers,
                                    |s, co| {
                     try!(s.print_string(&co, ast::CookedStr));
                     Ok(())
@@ -1984,7 +1984,7 @@ pub fn print_ident(&mut self, ident: ast::Ident) -> IoResult<()> {
     }
 
     pub fn print_usize(&mut self, i: usize) -> IoResult<()> {
-        word(&mut self.s, &i.to_string()[])
+        word(&mut self.s, &i.to_string())
     }
 
     pub fn print_name(&mut self, name: ast::Name) -> IoResult<()> {
@@ -2074,7 +2074,7 @@ fn print_path_parameters(&mut self,
                     }
                     try!(self.commasep(
                         Inconsistent,
-                        &data.types[],
+                        &data.types,
                         |s, ty| s.print_type(&**ty)));
                         comma = true;
                 }
@@ -2097,7 +2097,7 @@ fn print_path_parameters(&mut self,
                 try!(word(&mut self.s, "("));
                 try!(self.commasep(
                     Inconsistent,
-                    &data.inputs[],
+                    &data.inputs,
                     |s, ty| s.print_type(&**ty)));
                 try!(word(&mut self.s, ")"));
 
@@ -2242,7 +2242,7 @@ fn print_arm(&mut self, arm: &ast::Arm) -> IoResult<()> {
         }
         try!(self.cbox(indent_unit));
         try!(self.ibox(0));
-        try!(self.print_outer_attributes(&arm.attrs[]));
+        try!(self.print_outer_attributes(&arm.attrs));
         let mut first = true;
         for p in &arm.pats {
             if first {
@@ -2491,7 +2491,7 @@ pub fn print_generics(&mut self,
 
     pub fn print_ty_param(&mut self, param: &ast::TyParam) -> IoResult<()> {
         try!(self.print_ident(param.ident));
-        try!(self.print_bounds(":", &param.bounds[]));
+        try!(self.print_bounds(":", &param.bounds));
         match param.default {
             Some(ref default) => {
                 try!(space(&mut self.s));
@@ -2752,7 +2752,7 @@ pub fn print_literal(&mut self, lit: &ast::Lit) -> IoResult<()> {
         try!(self.maybe_print_comment(lit.span.lo));
         match self.next_lit(lit.span.lo) {
             Some(ref ltrl) => {
-                return word(&mut self.s, &(*ltrl).lit[]);
+                return word(&mut self.s, &(*ltrl).lit);
             }
             _ => ()
         }
@@ -2774,21 +2774,21 @@ pub fn print_literal(&mut self, lit: &ast::Lit) -> IoResult<()> {
                 match t {
                     ast::SignedIntLit(st, ast::Plus) => {
                         word(&mut self.s,
-                             &ast_util::int_ty_to_string(st, Some(i as i64))[])
+                             &ast_util::int_ty_to_string(st, Some(i as i64)))
                     }
                     ast::SignedIntLit(st, ast::Minus) => {
                         let istr = ast_util::int_ty_to_string(st, Some(-(i as i64)));
                         word(&mut self.s,
-                             &format!("-{}", istr)[])
+                             &format!("-{}", istr))
                     }
                     ast::UnsignedIntLit(ut) => {
                         word(&mut self.s, &ast_util::uint_ty_to_string(ut, Some(i)))
                     }
                     ast::UnsuffixedIntLit(ast::Plus) => {
-                        word(&mut self.s, &format!("{}", i)[])
+                        word(&mut self.s, &format!("{}", i))
                     }
                     ast::UnsuffixedIntLit(ast::Minus) => {
-                        word(&mut self.s, &format!("-{}", i)[])
+                        word(&mut self.s, &format!("-{}", i))
                     }
                 }
             }
@@ -2797,7 +2797,7 @@ pub fn print_literal(&mut self, lit: &ast::Lit) -> IoResult<()> {
                      &format!(
                          "{}{}",
                          &f,
-                         &ast_util::float_ty_to_string(t)[])[])
+                         &ast_util::float_ty_to_string(t)))
             }
             ast::LitFloatUnsuffixed(ref f) => word(&mut self.s, &f[..]),
             ast::LitBool(val) => {
@@ -2809,7 +2809,7 @@ pub fn print_literal(&mut self, lit: &ast::Lit) -> IoResult<()> {
                     escaped.extend(ascii::escape_default(ch as u8)
                                          .map(|c| c as char));
                 }
-                word(&mut self.s, &format!("b\"{}\"", escaped)[])
+                word(&mut self.s, &format!("b\"{}\"", escaped))
             }
         }
     }
@@ -2850,7 +2850,7 @@ pub fn print_comment(&mut self,
             comments::Mixed => {
                 assert_eq!(cmnt.lines.len(), 1);
                 try!(zerobreak(&mut self.s));
-                try!(word(&mut self.s, &cmnt.lines[0][]));
+                try!(word(&mut self.s, &cmnt.lines[0]));
                 zerobreak(&mut self.s)
             }
             comments::Isolated => {
@@ -2868,7 +2868,7 @@ pub fn print_comment(&mut self,
             comments::Trailing => {
                 try!(word(&mut self.s, " "));
                 if cmnt.lines.len() == 1 {
-                    try!(word(&mut self.s, &cmnt.lines[0][]));
+                    try!(word(&mut self.s, &cmnt.lines[0]));
                     hardbreak(&mut self.s)
                 } else {
                     try!(self.ibox(0));
@@ -2938,7 +2938,7 @@ pub fn print_opt_abi_and_extern_if_nondefault(&mut self,
             Some(abi::Rust) => Ok(()),
             Some(abi) => {
                 try!(self.word_nbsp("extern"));
-                self.word_nbsp(&abi.to_string()[])
+                self.word_nbsp(&abi.to_string())
             }
             None => Ok(())
         }
@@ -2949,7 +2949,7 @@ pub fn print_extern_opt_abi(&mut self,
         match opt_abi {
             Some(abi) => {
                 try!(self.word_nbsp("extern"));
-                self.word_nbsp(&abi.to_string()[])
+                self.word_nbsp(&abi.to_string())
             }
             None => Ok(())
         }
@@ -2964,7 +2964,7 @@ pub fn print_fn_header_info(&mut self,
 
         if abi != abi::Rust {
             try!(self.word_nbsp("extern"));
-            try!(self.word_nbsp(&abi.to_string()[]));
+            try!(self.word_nbsp(&abi.to_string()));
         }
 
         word(&mut self.s, "fn")
index 31b264eb76d67fe2a5cb8146dba0ffe79c4fe18a..7b1fc91e45b5bb3547841faf5f7505210a03b5f0 100644 (file)
@@ -119,7 +119,7 @@ fn fold_item(&mut self, i: P<ast::Item>) -> SmallVector<P<ast::Item>> {
             self.cx.path.push(ident);
         }
         debug!("current path: {}",
-               ast_util::path_name_i(&self.cx.path[]));
+               ast_util::path_name_i(&self.cx.path));
 
         if is_test_fn(&self.cx, &*i) || is_bench_fn(&self.cx, &*i) {
             match i.node {
index bd9a6d7c4feaba01f84bbffc9abf4d5e3f501b08..dffeac6f3f7938df88ae352309b3a9fb068c42f3 100644 (file)
@@ -144,7 +144,7 @@ pub fn len(&self) -> usize {
     }
 
     pub fn find<Q: ?Sized>(&self, val: &Q) -> Option<Name>
-    where Q: BorrowFrom<T> + Eq + Hash {
+    where T: Borrow<Q>, Q: Eq + Hash {
         let map = self.map.borrow();
         match (*map).get(val) {
             Some(v) => Some(*v),
@@ -285,7 +285,7 @@ pub fn find<Q: ?Sized>(&self, val: &Q) -> Option<Name>
     }
     #[cfg(not(stage0))]
     pub fn find<Q: ?Sized>(&self, val: &Q) -> Option<Name>
-    where Q: BorrowFrom<RcStr> + Eq + Hash {
+    where RcStr: Borrow<Q>, Q: Eq + Hash {
         match (*self.map.borrow()).get(val) {
             Some(v) => Some(*v),
             None => None,
index c97a9950d78d0ba6569dba1c89e4dc29dc7e445e..6bd21101a609df402b94dd01bb93a5a36892a5d7 100644 (file)
@@ -14,7 +14,7 @@
 #![feature(box_syntax)]
 
 struct Foo;
-trait Trait : ::std::marker::MarkerTrait {}
+trait Trait { fn foo(&self) {} }
 impl Trait for Foo {}
 
 pub fn main() {
index d8b3f297a1123cb14372239888d2f75d03001cab..4161cce2843b690fb65d53e86371f3f5cb5daaf9 100644 (file)
@@ -14,7 +14,7 @@
 #![feature(box_patterns)]
 #![feature(box_syntax)]
 
-trait T : ::std::marker::MarkerTrait {}
+trait T { fn foo(&self) {} }
 impl T for isize {}
 
 fn main() {
index 6d9ba8d44c089cead9ed0e1d687788448abd6994..ddc929017718d02b6729740f3386812063fef3bd 100644 (file)
@@ -15,7 +15,7 @@ struct Fat<T: ?Sized> {
 }
 
 struct Foo;
-trait Bar : ::std::marker::MarkerTrait {}
+trait Bar { fn bar(&self) {} }
 
 pub fn main() {
     // With a vec of isize.
index 46b89e1122a2c0ddc7ada5caada90a2a87232d75..7bad3bd69d3b01cbfe3a8cecbac6959bbf1deb7b 100644 (file)
@@ -15,7 +15,7 @@ struct Fat<T: ?Sized> {
 }
 
 struct Foo;
-trait Bar : ::std::marker::MarkerTrait {}
+trait Bar { fn bar(&self) {} }
 impl Bar for Foo {}
 
 fn baz<'a>() {
index a1f0dda671e7de9b8b1d9a586d4696a2867f84e7..b4fd45845f7a024da42365a2a0639b0927cda1be 100644 (file)
@@ -10,7 +10,7 @@
 
 // Test that we cannot create objects from unsized types.
 
-trait Foo : ::std::marker::MarkerTrait {}
+trait Foo { fn foo(&self) {} }
 impl Foo for str {}
 
 fn test1<T: ?Sized + Foo>(t: &T) {
index eccbc7896605e13106a72aaa467c9539254dca5f..4d721ad76666dab6c2482a1e207cb0ce31542522 100644 (file)
@@ -10,9 +10,7 @@
 
 #![feature(box_syntax)]
 
-use std::marker::MarkerTrait;
-
-trait Foo : MarkerTrait {}
+trait Foo { fn foo(&self) {} }
 impl Foo for u8 {}
 
 fn main() {
index e146cac21a31c46692fb5c8ab48ad19e843c615d..0072b1228af486d49b47c8e20f3c41c8dd8b83bc 100644 (file)
@@ -15,6 +15,7 @@
 use std::any::Any;
 
 trait Foo : Copy {
+    fn foo(&self) {}
 }
 
 impl<T:Copy> Foo for T {
index 05c6c6d9f9e02dddde174e0241d411a22fb0d0d1..bdc52eca2cb2ded04fe7faa06459efa25b60f4dc 100644 (file)
@@ -11,8 +11,6 @@
 #![feature(box_syntax)]
 #![allow(warnings)]
 
-use std::marker::MarkerTrait;
-
 trait A<T>
 {
     fn get(&self) -> T { panic!() }
@@ -20,7 +18,7 @@ fn get(&self) -> T { panic!() }
 
 struct B<'a, T>(&'a (A<T>+'a));
 
-trait X : MarkerTrait {}
+trait X { fn foo(&self) {} }
 
 impl<'a, T> X for B<'a, T> {}
 
index 9ad49a6703ee3abc939afb4cabb84eba2b67d4c5..655ac6f66c97db2ac173069431fcb36ce6203896 100644 (file)
@@ -10,7 +10,7 @@
 
 #![feature(box_syntax)]
 
-trait X : ::std::marker::MarkerTrait {}
+trait X { fn foo(&self) {} }
 
 fn p1<T>(v: T) -> Box<X+'static>
     where T : X
index be0c88f557cc7e87bd01c3cc4efbbc9b1e4262d1..a2b0fa566353041f8f6bc5720cf4629a18a398a8 100644 (file)
@@ -16,7 +16,7 @@
 use std::marker;
 
 fn main() {
-    trait T : marker::MarkerTrait {}
+    trait T { fn foo(&self) {} }
 
     fn f<'a, V: T>(v: &'a V) -> &'a T {
         v as &'a T
index 4f3db1352bbd234d66b6ab0380cc91fe50aaf991..db7eacce9d10b007292ae09dce9b550eef54543f 100644 (file)
@@ -19,7 +19,7 @@
 #[derive(Clone)]
 struct B1;
 
-trait A : std::marker::MarkerTrait {}
+trait A { fn foo(&self) {} }
 impl A for B1 {}
 
 fn main() {
index bd2bf430a686cd9f74b349e0f78a83f78fb0a5cb..7db1d7d031e3c2f84f94cf15982829fcd3789db7 100644 (file)
@@ -16,7 +16,8 @@
 
 static mut COUNT: uint = 1;
 
-trait T : ::std::marker::MarkerTrait {
+trait T {
+    fn foo(&self) {}
 }
 
 impl<'a> T+'a {
index 1d4eb0a75232d9b8f61f69cfa11dcfb8f8d119fc..f01a56142e0730184635b00609050db1ce8333c6 100644 (file)
@@ -13,7 +13,7 @@
 #![allow(unknown_features)]
 #![feature(box_syntax)]
 
-pub trait EventLoop : ::std::marker::MarkerTrait { }
+pub trait EventLoop { fn foo(&self) {} }
 
 pub struct UvEventLoop {
     uvio: int