diff options
| author | bors <bors@rust-lang.org> | 2013-02-19 12:24:30 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-02-19 12:24:30 -0800 |
| commit | 1f956fc3b2ad6f1b8db3d580a409fb5636c8297f (patch) | |
| tree | 432dbd8dd2a3a2e0434cd4a9fc5c66e8718776ad /src/libsyntax/parse | |
| parent | a782efc4f16fed52f1f82af5869bfb5285bbc3f4 (diff) | |
| parent | 68746cd4fb93e95a393c539abc65b93ed5eecdb5 (diff) | |
| download | rust-1f956fc3b2ad6f1b8db3d580a409fb5636c8297f.tar.gz rust-1f956fc3b2ad6f1b8db3d580a409fb5636c8297f.zip | |
auto merge of #4999 : erickt/rust/incoming, r=brson
This patch series is doing a couple things with the ultimate goal of removing `#[allow(vecs_implicitly_copyable)]`, although I'm not quite there yet. The main change is passing around `@~str`s in most places, and using `ref`s in others. As far as I could tell, there are no performance changes with these patches, and all the tests pass on my mac.
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/attr.rs | 32 | ||||
| -rw-r--r-- | src/libsyntax/parse/comments.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 14 | ||||
| -rw-r--r-- | src/libsyntax/parse/token.rs | 4 |
4 files changed, 28 insertions, 28 deletions
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index e297e33d825..34ac5c16841 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -126,23 +126,23 @@ impl parser_attr for Parser { fn parse_meta_item() -> @ast::meta_item { let lo = self.span.lo; - let name = *self.id_to_str(self.parse_ident()); + let name = self.id_to_str(self.parse_ident()); match self.token { - token::EQ => { - self.bump(); - let lit = self.parse_lit(); - let mut hi = self.span.hi; - return @spanned(lo, hi, ast::meta_name_value(name, lit)); - } - token::LPAREN => { - let inner_items = self.parse_meta_seq(); - let mut hi = self.span.hi; - return @spanned(lo, hi, ast::meta_list(name, inner_items)); - } - _ => { - let mut hi = self.span.hi; - return @spanned(lo, hi, ast::meta_word(name)); - } + token::EQ => { + self.bump(); + let lit = self.parse_lit(); + let mut hi = self.span.hi; + @spanned(lo, hi, ast::meta_name_value(name, lit)) + } + token::LPAREN => { + let inner_items = self.parse_meta_seq(); + let mut hi = self.span.hi; + @spanned(lo, hi, ast::meta_list(name, inner_items)) + } + _ => { + let mut hi = self.span.hi; + @spanned(lo, hi, ast::meta_word(name)) + } } } diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs index d58d894b6a0..e27784d1f6b 100644 --- a/src/libsyntax/parse/comments.rs +++ b/src/libsyntax/parse/comments.rs @@ -46,14 +46,14 @@ impl cmp::Eq for cmnt_style { pub type cmnt = {style: cmnt_style, lines: ~[~str], pos: BytePos}; -pub fn is_doc_comment(s: ~str) -> bool { +pub fn is_doc_comment(s: &str) -> bool { (s.starts_with(~"///") && !is_line_non_doc_comment(s)) || s.starts_with(~"//!") || (s.starts_with(~"/**") && !is_block_non_doc_comment(s)) || s.starts_with(~"/*!") } -pub fn doc_comment_style(comment: ~str) -> ast::attr_style { +pub fn doc_comment_style(comment: &str) -> ast::attr_style { assert is_doc_comment(comment); if comment.starts_with(~"//!") || comment.starts_with(~"/*!") { ast::attr_inner @@ -62,7 +62,7 @@ pub fn doc_comment_style(comment: ~str) -> ast::attr_style { } } -pub fn strip_doc_comment_decoration(comment: ~str) -> ~str { +pub fn strip_doc_comment_decoration(comment: &str) -> ~str { /// remove whitespace-only lines from the start/end of lines fn vertical_trim(lines: ~[~str]) -> ~[~str] { diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index e5b3024d3dc..644d6ed5189 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3267,11 +3267,11 @@ pub impl Parser { // 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") { - Some(ref path) => { + Some(path) => { let prefix = Path( self.sess.cm.span_to_filename(copy self.span)); let prefix = prefix.dir_path(); - let path = Path((*path)); + let path = Path(copy *path); let (new_mod_item, new_attrs) = self.eval_src_mod_from_path( prefix, path, ~[], id_span); @@ -3300,7 +3300,7 @@ pub impl Parser { let file_path = match ::attr::first_attr_value_str_by_name( attrs, ~"path") { - Some(ref d) => (*d), + Some(d) => copy *d, None => copy *default_path }; self.mod_path_stack.push(file_path) @@ -3320,10 +3320,10 @@ pub impl Parser { let default_path = self.sess.interner.get(id) + ~".rs"; let file_path = match ::attr::first_attr_value_str_by_name( outer_attrs, ~"path") { - Some(ref d) => { - let path = Path(*d); + Some(d) => { + let path = Path(copy *d); if !path.is_absolute { - mod_path.push(*d) + mod_path.push(copy *d) } else { path } @@ -3357,7 +3357,7 @@ pub impl Parser { fn cdir_path_opt(default: ~str, attrs: ~[ast::attribute]) -> ~str { match ::attr::first_attr_value_str_by_name(attrs, ~"path") { - Some(ref d) => (*d), + Some(d) => copy *d, None => default } } diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index bdd26fc00a7..f145e433fa7 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -429,7 +429,7 @@ pub fn mk_ident_interner() -> @ident_interner { ]; let rv = @ident_interner { - interner: interner::mk_prefill(init_vec) + interner: interner::Interner::prefill(init_vec) }; task::local_data::local_data_set(interner_key!(), @rv); @@ -443,7 +443,7 @@ pub fn mk_ident_interner() -> @ident_interner { /* for when we don't care about the contents; doesn't interact with TLD or serialization */ pub fn mk_fake_ident_interner() -> @ident_interner { - @ident_interner { interner: interner::mk::<@~str>() } + @ident_interner { interner: interner::Interner::new() } } /** |
