diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-05-12 00:25:31 -0400 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-05-14 12:24:43 -0400 |
| commit | 92d39fe4d5e5ad3d2c2dcafe45eaf6e23edddfd7 (patch) | |
| tree | 817ebba2489c228d8494662b4ce188e0782b321a /src/libsyntax/parse | |
| parent | 2951527528b39dbf47c02b3d329129d677ddcdfd (diff) | |
| download | rust-92d39fe4d5e5ad3d2c2dcafe45eaf6e23edddfd7.tar.gz rust-92d39fe4d5e5ad3d2c2dcafe45eaf6e23edddfd7.zip | |
syntax: Remove #[allow(vecs_implicitly_copyable)]
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/comments.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/obsolete.rs | 14 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 39 |
3 files changed, 29 insertions, 26 deletions
diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs index 8faba022a90..fa91b968f69 100644 --- a/src/libsyntax/parse/comments.rs +++ b/src/libsyntax/parse/comments.rs @@ -192,7 +192,7 @@ fn read_line_comments(rdr: @mut StringReader, code_to_the_left: bool, // FIXME #3961: This is not the right way to convert string byte // offsets to characters. -fn all_whitespace(s: ~str, begin: uint, end: uint) -> bool { +fn all_whitespace(s: &str, begin: uint, end: uint) -> bool { let mut i: uint = begin; while i != end { if !is_whitespace(s[i] as char) { return false; } i += 1u; diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs index 3e64133e893..211d123e887 100644 --- a/src/libsyntax/parse/obsolete.rs +++ b/src/libsyntax/parse/obsolete.rs @@ -253,9 +253,9 @@ pub impl Parser { } } - fn token_is_obsolete_ident(&self, ident: &str, token: Token) -> bool { - match token { - token::IDENT(copy sid, _) => { + fn token_is_obsolete_ident(&self, ident: &str, token: &Token) -> bool { + match *token { + token::IDENT(sid, _) => { str::eq_slice(*self.id_to_str(sid), ident) } _ => false @@ -263,7 +263,7 @@ pub impl Parser { } fn is_obsolete_ident(&self, ident: &str) -> bool { - self.token_is_obsolete_ident(ident, *self.token) + self.token_is_obsolete_ident(ident, self.token) } fn eat_obsolete_ident(&self, ident: &str) -> bool { @@ -289,7 +289,7 @@ pub impl Parser { fn try_parse_obsolete_with(&self) -> bool { if *self.token == token::COMMA && self.token_is_obsolete_ident("with", - self.look_ahead(1u)) { + &self.look_ahead(1u)) { self.bump(); } if self.eat_obsolete_ident("with") { @@ -301,13 +301,13 @@ pub impl Parser { } } - fn try_parse_obsolete_priv_section(&self, attrs: ~[attribute]) -> bool { + fn try_parse_obsolete_priv_section(&self, attrs: &[attribute]) -> bool { if self.is_keyword(&~"priv") && self.look_ahead(1) == token::LBRACE { self.obsolete(copy *self.span, ObsoletePrivSection); self.eat_keyword(&~"priv"); self.bump(); while *self.token != token::RBRACE { - self.parse_single_struct_field(ast::private, attrs); + self.parse_single_struct_field(ast::private, attrs.to_owned()); } self.bump(); true diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index b35ae169e1a..2a7af36f6f2 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -708,7 +708,7 @@ pub impl Parser { self.obsolete(*self.last_span, ObsoleteBareFnType); result } else if *self.token == token::MOD_SEP - || is_ident_or_path(&*self.token) { + || is_ident_or_path(self.token) { // NAMED TYPE let path = self.parse_path_with_tps(false); ty_path(path, self.get_id()) @@ -1556,9 +1556,12 @@ pub impl Parser { |p| p.parse_token_tree() ); let (s, z) = p.parse_sep_and_zerok(); + let seq = match seq { + spanned { node, _ } => node, + }; tt_seq( - mk_sp(sp.lo ,p.span.hi), - seq.node, + mk_sp(sp.lo, p.span.hi), + seq, s, z ) @@ -1624,9 +1627,9 @@ pub impl Parser { token::LBRACE | token::LPAREN | token::LBRACKET => { self.parse_matcher_subseq( name_idx, - *self.token, + copy *self.token, // tjc: not sure why we need a copy - token::flip_delimiter(&*self.token) + token::flip_delimiter(self.token) ) } _ => self.fatal(~"expected open delimiter") @@ -1986,14 +1989,15 @@ pub impl Parser { // them as the lambda arguments let e = self.parse_expr_res(RESTRICT_NO_BAR_OR_DOUBLEBAR_OP); match e.node { - expr_call(f, args, NoSugar) => { + expr_call(f, /*bad*/ copy args, NoSugar) => { let block = self.parse_lambda_block_expr(); let last_arg = self.mk_expr(block.span.lo, block.span.hi, ctor(block)); let args = vec::append(args, ~[last_arg]); self.mk_expr(lo.lo, block.span.hi, expr_call(f, args, sugar)) } - expr_method_call(f, i, tps, args, NoSugar) => { + expr_method_call(f, i, /*bad*/ copy tps, + /*bad*/ copy args, NoSugar) => { let block = self.parse_lambda_block_expr(); let last_arg = self.mk_expr(block.span.lo, block.span.hi, ctor(block)); @@ -2001,7 +2005,7 @@ pub impl Parser { self.mk_expr(lo.lo, block.span.hi, expr_method_call(f, i, tps, args, sugar)) } - expr_field(f, i, tps) => { + expr_field(f, i, /*bad*/ copy tps) => { let block = self.parse_lambda_block_expr(); let last_arg = self.mk_expr(block.span.lo, block.span.hi, ctor(block)); @@ -2259,7 +2263,7 @@ pub impl Parser { let lo = self.span.lo; let mut hi = self.span.hi; let pat; - match *self.token { + match /*bad*/ copy *self.token { // parse _ token::UNDERSCORE => { self.bump(); pat = pat_wild; } // parse @pat @@ -2373,8 +2377,8 @@ pub impl Parser { self.expect(&token::RBRACKET); pat = ast::pat_vec(before, slice, after); } - tok => { - if !is_ident_or_path(&tok) + ref tok => { + if !is_ident_or_path(tok) || self.is_keyword(&~"true") || self.is_keyword(&~"false") { @@ -2897,7 +2901,7 @@ pub impl Parser { loop; } - if is_ident_or_path(&*self.token) { + if is_ident_or_path(self.token) { self.obsolete(*self.span, ObsoleteTraitBoundSeparator); } @@ -3531,6 +3535,7 @@ pub impl Parser { fn parse_item_mod(&self, outer_attrs: ~[ast::attribute]) -> item_info { let id_span = *self.span; let id = self.parse_ident(); + let merge = ::attr::first_attr_value_str_by_name(outer_attrs, "merge"); let info_ = if *self.token == token::SEMI { self.bump(); // This mod is in an external file. Let's go get it! @@ -3550,7 +3555,7 @@ pub impl Parser { // (int-template, iter-trait). If there's a 'merge' attribute // on the mod, then we'll go and suck in another file and merge // its contents - match ::attr::first_attr_value_str_by_name(outer_attrs, ~"merge") { + match merge { Some(path) => { let prefix = Path( self.sess.cm.span_to_filename(*self.span)); @@ -3636,10 +3641,7 @@ pub impl Parser { new_sub_parser_from_file(self.sess, copy self.cfg, &full_path, id_sp); let (inner, next) = p0.parse_inner_attrs_and_next(); - let mod_attrs = vec::append( - /*bad*/ copy outer_attrs, - inner - ); + let mod_attrs = vec::append(outer_attrs, inner); let first_item_outer_attrs = next; let m0 = p0.parse_mod_items(token::EOF, first_item_outer_attrs); return (ast::item_mod(m0), mod_attrs); @@ -4105,7 +4107,8 @@ pub impl Parser { } if self.eat_keyword(&~"mod") { // MODULE ITEM - let (ident, item_, extra_attrs) = self.parse_item_mod(attrs); + let (ident, item_, extra_attrs) = + self.parse_item_mod(/*bad*/ copy attrs); return iovi_item(self.mk_item(lo, self.last_span.hi, ident, item_, visibility, maybe_append(attrs, extra_attrs))); |
