diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2014-03-20 01:52:37 +1100 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2014-03-22 09:54:18 +1100 |
| commit | e33676b7936b12bb68f47857ab3f8ea9b757d0d5 (patch) | |
| tree | 64e49bfdfb621bca44056fb4810c4f487f74940b /src/libsyntax/parse | |
| parent | 0384952a657e49d1f1cbab7c21dee91cd2c4f585 (diff) | |
| download | rust-e33676b7936b12bb68f47857ab3f8ea9b757d0d5.tar.gz rust-e33676b7936b12bb68f47857ab3f8ea9b757d0d5.zip | |
Migrate all users of opt_vec to owned_slice, delete opt_vec.
syntax::opt_vec is now entirely unused, and so can go.
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 22 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 33 |
2 files changed, 27 insertions, 28 deletions
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 286b44e5c80..eb6b462fb94 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -279,7 +279,7 @@ mod test { use std::io::MemWriter; use std::str; use codemap::{Span, BytePos, Spanned}; - use opt_vec; + use owned_slice::OwnedSlice; use ast; use abi; use parse::parser::Parser; @@ -312,7 +312,7 @@ mod test { ast::PathSegment { identifier: str_to_ident("a"), lifetimes: Vec::new(), - types: opt_vec::Empty, + types: OwnedSlice::empty(), } ), }), @@ -331,12 +331,12 @@ mod test { ast::PathSegment { identifier: str_to_ident("a"), lifetimes: Vec::new(), - types: opt_vec::Empty, + types: OwnedSlice::empty(), }, ast::PathSegment { identifier: str_to_ident("b"), lifetimes: Vec::new(), - types: opt_vec::Empty, + types: OwnedSlice::empty(), } ) }), @@ -545,7 +545,7 @@ mod test { ast::PathSegment { identifier: str_to_ident("d"), lifetimes: Vec::new(), - types: opt_vec::Empty, + types: OwnedSlice::empty(), } ), }), @@ -567,7 +567,7 @@ mod test { ast::PathSegment { identifier: str_to_ident("b"), lifetimes: Vec::new(), - types: opt_vec::Empty, + types: OwnedSlice::empty(), } ), }), @@ -595,7 +595,7 @@ mod test { ast::PathSegment { identifier: str_to_ident("b"), lifetimes: Vec::new(), - types: opt_vec::Empty, + types: OwnedSlice::empty(), } ), }, @@ -623,7 +623,7 @@ mod test { identifier: str_to_ident("int"), lifetimes: Vec::new(), - types: opt_vec::Empty, + types: OwnedSlice::empty(), } ), }, None, ast::DUMMY_NODE_ID), @@ -641,7 +641,7 @@ mod test { identifier: str_to_ident("b"), lifetimes: Vec::new(), - types: opt_vec::Empty, + types: OwnedSlice::empty(), } ), }, @@ -661,7 +661,7 @@ mod test { abi::AbiSet::Rust(), ast::Generics{ // no idea on either of these: lifetimes: Vec::new(), - ty_params: opt_vec::Empty, + ty_params: OwnedSlice::empty(), }, ast::P(ast::Block { view_items: Vec::new(), @@ -680,7 +680,7 @@ mod test { lifetimes: Vec::new(), types: - opt_vec::Empty + OwnedSlice::empty() } ), }), diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 3e2b88c1cf1..c8492cc4113 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -75,8 +75,7 @@ use parse::token::{is_ident, is_ident_or_path, is_plain_ident}; use parse::token::{keywords, special_idents, token_to_binop}; use parse::token; use parse::{new_sub_parser_from_file, ParseSess}; -use opt_vec; -use opt_vec::OptVec; +use owned_slice::OwnedSlice; use std::cell::Cell; use collections::HashSet; @@ -117,13 +116,13 @@ pub enum PathParsingMode { /// for the definition of a path segment.) struct PathSegmentAndBoundSet { segment: ast::PathSegment, - bound_set: Option<OptVec<TyParamBound>>, + bound_set: Option<OwnedSlice<TyParamBound>>, } /// A path paired with optional type bounds. pub struct PathAndBounds { path: ast::Path, - bounds: Option<OptVec<TyParamBound>>, + bounds: Option<OwnedSlice<TyParamBound>>, } enum ItemOrViewItem { @@ -630,7 +629,7 @@ impl<'a> Parser<'a> { &mut self, sep: Option<token::Token>, f: |&mut Parser| -> T) - -> OptVec<T> { + -> OwnedSlice<T> { let mut first = true; let mut v = Vec::new(); while self.token != token::GT @@ -644,14 +643,14 @@ impl<'a> Parser<'a> { } v.push(f(self)); } - return opt_vec::from(v); + return OwnedSlice::from_vec(v); } pub fn parse_seq_to_gt<T>( &mut self, sep: Option<token::Token>, f: |&mut Parser| -> T) - -> OptVec<T> { + -> OwnedSlice<T> { let v = self.parse_seq_to_before_gt(sep, f); self.expect_gt(); return v; @@ -1531,7 +1530,7 @@ impl<'a> Parser<'a> { segment: ast::PathSegment { identifier: identifier, lifetimes: Vec::new(), - types: opt_vec::Empty, + types: OwnedSlice::empty(), }, bound_set: bound_set }); @@ -1543,9 +1542,9 @@ impl<'a> Parser<'a> { if mode != NoTypesAllowed && self.eat(&token::LT) { let (lifetimes, types) = self.parse_generic_values_after_lt(); - (true, lifetimes, opt_vec::from(types)) + (true, lifetimes, OwnedSlice::from_vec(types)) } else { - (false, Vec::new(), opt_vec::Empty) + (false, Vec::new(), OwnedSlice::empty()) } }; @@ -3432,7 +3431,7 @@ impl<'a> Parser<'a> { // Returns "Some(Empty)" if there's a colon but nothing after (e.g. "T:") // Returns "Some(stuff)" otherwise (e.g. "T:stuff"). // NB: The None/Some distinction is important for issue #7264. - fn parse_optional_ty_param_bounds(&mut self) -> Option<OptVec<TyParamBound>> { + fn parse_optional_ty_param_bounds(&mut self) -> Option<OwnedSlice<TyParamBound>> { if !self.eat(&token::COLON) { return None; } @@ -3462,7 +3461,7 @@ impl<'a> Parser<'a> { } } - return Some(opt_vec::from(result)); + return Some(OwnedSlice::from_vec(result)); } // matches typaram = IDENT optbounds ( EQ ty )? @@ -3515,7 +3514,7 @@ impl<'a> Parser<'a> { let result = self.parse_seq_to_gt( Some(token::COMMA), |p| p.parse_ty(false)); - (lifetimes, opt_vec::take_vec(result)) + (lifetimes, result.into_vec()) } fn parse_fn_args(&mut self, named_args: bool, allow_variadic: bool) @@ -4882,7 +4881,7 @@ impl<'a> Parser<'a> { ast::PathSegment { identifier: identifier, lifetimes: Vec::new(), - types: opt_vec::Empty, + types: OwnedSlice::empty(), } }).collect() }; @@ -4917,7 +4916,7 @@ impl<'a> Parser<'a> { ast::PathSegment { identifier: identifier, lifetimes: Vec::new(), - types: opt_vec::Empty, + types: OwnedSlice::empty(), } }).collect() }; @@ -4935,7 +4934,7 @@ impl<'a> Parser<'a> { ast::PathSegment { identifier: identifier, lifetimes: Vec::new(), - types: opt_vec::Empty, + types: OwnedSlice::empty(), } }).collect() }; @@ -4957,7 +4956,7 @@ impl<'a> Parser<'a> { ast::PathSegment { identifier: identifier, lifetimes: Vec::new(), - types: opt_vec::Empty, + types: OwnedSlice::empty(), } }).collect() }; |
