Migrate all users of opt_vec to owned_slice, delete opt_vec.
syntax::opt_vec is now entirely unused, and so can go.
This commit is contained in:
parent
0384952a65
commit
e33676b793
35 changed files with 162 additions and 340 deletions
|
@ -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()
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue