diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2014-03-07 16:50:40 +0100 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2014-03-12 08:05:20 +0100 |
| commit | 586b619c76a3e5798283408954a0306d86ebc1ef (patch) | |
| tree | ae1f2910935851e30fbbef23b9d5465b1f117461 | |
| parent | 28ebec516015eb0b9cef05e5da0685a18620b105 (diff) | |
| download | rust-586b619c76a3e5798283408954a0306d86ebc1ef.tar.gz rust-586b619c76a3e5798283408954a0306d86ebc1ef.zip | |
Changed lists of lifetimes in ast and ty to use Vec instead of OptVec.
There is a broader revision (that does this across the board) pending in #12675, but that is awaiting the arrival of more data (to decide whether to keep OptVec alive by using a non-Vec internally). For this code, the representation of lifetime lists needs to be the same in both ScopeChain and in the ast and ty structures. So it seemed cleanest to just use `vec_ng::Vec`, now that it has a cheaper empty representation than the current `vec` code.
| -rw-r--r-- | src/librustc/front/std_inject.rs | 4 | ||||
| -rw-r--r-- | src/librustc/front/test.rs | 4 | ||||
| -rw-r--r-- | src/librustc/middle/privacy.rs | 3 | ||||
| -rw-r--r-- | src/librustc/middle/resolve_lifetime.rs | 10 | ||||
| -rw-r--r-- | src/librustc/middle/trans/debuginfo.rs | 2 | ||||
| -rw-r--r-- | src/librustc/middle/typeck/astconv.rs | 8 | ||||
| -rw-r--r-- | src/librustc/middle/typeck/check/mod.rs | 9 | ||||
| -rw-r--r-- | src/libsyntax/ast.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/ast_util.rs | 7 | ||||
| -rw-r--r-- | src/libsyntax/ext/build.rs | 12 | ||||
| -rw-r--r-- | src/libsyntax/ext/concat_idents.rs | 3 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/rand.rs | 3 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/ty.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/ext/env.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/format.rs | 7 | ||||
| -rw-r--r-- | src/libsyntax/fold.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 14 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 26 | ||||
| -rw-r--r-- | src/libsyntax/visit.rs | 5 |
19 files changed, 72 insertions, 71 deletions
diff --git a/src/librustc/front/std_inject.rs b/src/librustc/front/std_inject.rs index 564d6a717ff..c1fd83cab54 100644 --- a/src/librustc/front/std_inject.rs +++ b/src/librustc/front/std_inject.rs @@ -164,12 +164,12 @@ impl fold::Folder for PreludeInjector { segments: vec!( ast::PathSegment { identifier: token::str_to_ident("std"), - lifetimes: opt_vec::Empty, + lifetimes: Vec::new(), types: opt_vec::Empty, }, ast::PathSegment { identifier: token::str_to_ident("prelude"), - lifetimes: opt_vec::Empty, + lifetimes: Vec::new(), types: opt_vec::Empty, }), }; diff --git a/src/librustc/front/test.rs b/src/librustc/front/test.rs index 703722ccb1c..d403efcf8cd 100644 --- a/src/librustc/front/test.rs +++ b/src/librustc/front/test.rs @@ -369,7 +369,7 @@ fn path_node(ids: Vec<ast::Ident> ) -> ast::Path { global: false, segments: ids.move_iter().map(|identifier| ast::PathSegment { identifier: identifier, - lifetimes: opt_vec::Empty, + lifetimes: Vec::new(), types: opt_vec::Empty, }).collect() } @@ -381,7 +381,7 @@ fn path_node_global(ids: Vec<ast::Ident> ) -> ast::Path { global: true, segments: ids.move_iter().map(|identifier| ast::PathSegment { identifier: identifier, - lifetimes: opt_vec::Empty, + lifetimes: Vec::new(), types: opt_vec::Empty, }).collect() } diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs index 0a0bcc4ae0e..5cee3e1a20d 100644 --- a/src/librustc/middle/privacy.rs +++ b/src/librustc/middle/privacy.rs @@ -13,6 +13,7 @@ //! which are available for use externally when compiled as a library. use std::mem::replace; +use std::vec_ng::Vec; use metadata::csearch; use middle::lint; @@ -855,7 +856,7 @@ impl<'a> Visitor<()> for PrivacyVisitor<'a> { debug!("privacy - list {}", pid.node.id); let seg = ast::PathSegment { identifier: pid.node.name, - lifetimes: opt_vec::Empty, + lifetimes: Vec::new(), types: opt_vec::Empty, }; let segs = vec!(seg); diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index 90069cf899b..6a55b05b77e 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -19,10 +19,10 @@ use driver::session; use std::cell::RefCell; +use std::vec_ng::Vec; use util::nodemap::NodeMap; use syntax::ast; use syntax::codemap::Span; -use syntax::opt_vec::OptVec; use syntax::parse::token::special_idents; use syntax::parse::token; use syntax::print::pprust::{lifetime_to_str}; @@ -39,8 +39,8 @@ struct LifetimeContext { } enum ScopeChain<'a> { - ItemScope(&'a OptVec<ast::Lifetime>), - FnScope(ast::NodeId, &'a OptVec<ast::Lifetime>, Scope<'a>), + ItemScope(&'a Vec<ast::Lifetime>), + FnScope(ast::NodeId, &'a Vec<ast::Lifetime>, Scope<'a>), BlockScope(ast::NodeId, Scope<'a>), RootScope } @@ -267,7 +267,7 @@ impl LifetimeContext { token::get_name(lifetime_ref.name))); } - fn check_lifetime_names(&self, lifetimes: &OptVec<ast::Lifetime>) { + fn check_lifetime_names(&self, lifetimes: &Vec<ast::Lifetime>) { for i in range(0, lifetimes.len()) { let lifetime_i = lifetimes.get(i); @@ -313,7 +313,7 @@ impl LifetimeContext { } } -fn search_lifetimes(lifetimes: &OptVec<ast::Lifetime>, +fn search_lifetimes(lifetimes: &Vec<ast::Lifetime>, lifetime_ref: &ast::Lifetime) -> Option<(uint, ast::NodeId)> { for (i, lifetime_decl) in lifetimes.iter().enumerate() { diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs index 0e7c371b43d..6ade20d2913 100644 --- a/src/librustc/middle/trans/debuginfo.rs +++ b/src/librustc/middle/trans/debuginfo.rs @@ -540,7 +540,7 @@ pub fn create_function_debug_context(cx: &CrateContext, return FunctionWithoutDebugInfo; } - let empty_generics = ast::Generics { lifetimes: opt_vec::Empty, ty_params: opt_vec::Empty }; + let empty_generics = ast::Generics { lifetimes: Vec::new(), ty_params: opt_vec::Empty }; let fnitem = cx.tcx.map.get(fn_ast_id); diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs index 085a8a4efeb..e8770f9d142 100644 --- a/src/librustc/middle/typeck/astconv.rs +++ b/src/librustc/middle/typeck/astconv.rs @@ -186,9 +186,9 @@ fn ast_path_substs<AC:AstConv,RS:RegionScope>( } match anon_regions { - Ok(v) => opt_vec::from(v.move_iter().collect()), - Err(()) => opt_vec::from(Vec::from_fn(expected_num_region_params, - |_| ty::ReStatic)) // hokey + Ok(v) => v.move_iter().collect(), + Err(()) => Vec::from_fn(expected_num_region_params, + |_| ty::ReStatic) // hokey } }; @@ -231,7 +231,7 @@ fn ast_path_substs<AC:AstConv,RS:RegionScope>( .collect(); let mut substs = substs { - regions: ty::NonerasedRegions(regions), + regions: ty::NonerasedRegions(opt_vec::from(regions)), self_ty: self_ty, tps: tps }; diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index e0b6fc4597c..b10e1bcd5de 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -1453,8 +1453,7 @@ pub fn impl_self_ty(vcx: &VtableContext, let tps = vcx.infcx.next_ty_vars(n_tps); let substs = substs { - regions: ty::NonerasedRegions(opt_vec::from(rps.move_iter() - .collect())), + regions: ty::NonerasedRegions(opt_vec::from(rps.move_iter().collect())), self_ty: None, tps: tps, }; @@ -3741,11 +3740,11 @@ pub fn instantiate_path(fcx: @FnCtxt, nsupplied = num_supplied_regions)); } - opt_vec::from(fcx.infcx().next_region_vars( + fcx.infcx().next_region_vars( infer::BoundRegionInTypeOrImpl(span), - num_expected_regions).move_iter().collect()) + num_expected_regions).move_iter().collect() }; - let regions = ty::NonerasedRegions(regions); + let regions = ty::NonerasedRegions(opt_vec::from(regions)); // Special case: If there is a self parameter, omit it from the list of // type parameters. diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 372641af5f8..b6b18f6671d 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -142,7 +142,7 @@ pub struct PathSegment { /// The identifier portion of this path segment. identifier: Ident, /// The lifetime parameters for this path segment. - lifetimes: OptVec<Lifetime>, + lifetimes: Vec<Lifetime>, /// The type parameters for this path segment, if present. types: OptVec<P<Ty>>, } @@ -187,7 +187,7 @@ pub struct TyParam { #[deriving(Clone, Eq, Encodable, Decodable, Hash)] pub struct Generics { - lifetimes: OptVec<Lifetime>, + lifetimes: Vec<Lifetime>, ty_params: OptVec<TyParam>, } @@ -795,7 +795,7 @@ impl fmt::Show for Onceness { pub struct ClosureTy { sigil: Sigil, region: Option<Lifetime>, - lifetimes: OptVec<Lifetime>, + lifetimes: Vec<Lifetime>, purity: Purity, onceness: Onceness, decl: P<FnDecl>, @@ -810,7 +810,7 @@ pub struct ClosureTy { pub struct BareFnTy { purity: Purity, abis: AbiSet, - lifetimes: OptVec<Lifetime>, + lifetimes: Vec<Lifetime>, decl: P<FnDecl> } diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index a6e3111fe3f..d45ea206792 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -195,7 +195,7 @@ pub fn ident_to_path(s: Span, identifier: Ident) -> Path { segments: vec!( ast::PathSegment { identifier: identifier, - lifetimes: opt_vec::Empty, + lifetimes: Vec::new(), types: opt_vec::Empty, } ), @@ -311,7 +311,7 @@ pub fn operator_prec(op: ast::BinOp) -> uint { pub static as_prec: uint = 12u; pub fn empty_generics() -> Generics { - Generics {lifetimes: opt_vec::Empty, + Generics {lifetimes: Vec::new(), ty_params: opt_vec::Empty} } @@ -690,10 +690,11 @@ mod test { use ast::*; use super::*; use opt_vec; + use std::vec_ng::Vec; fn ident_to_segment(id : &Ident) -> PathSegment { PathSegment {identifier:id.clone(), - lifetimes: opt_vec::Empty, + lifetimes: Vec::new(), types: opt_vec::Empty} } diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index e644eca8f7d..6aa90e5e842 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -42,7 +42,7 @@ pub trait AstBuilder { fn path_all(&self, sp: Span, global: bool, idents: Vec<ast::Ident> , - lifetimes: OptVec<ast::Lifetime>, + lifetimes: Vec<ast::Lifetime>, types: Vec<P<ast::Ty>> ) -> ast::Path; @@ -255,19 +255,19 @@ pub trait AstBuilder { impl<'a> AstBuilder for ExtCtxt<'a> { fn path(&self, span: Span, strs: Vec<ast::Ident> ) -> ast::Path { - self.path_all(span, false, strs, opt_vec::Empty, Vec::new()) + self.path_all(span, false, strs, Vec::new(), Vec::new()) } fn path_ident(&self, span: Span, id: ast::Ident) -> ast::Path { self.path(span, vec!(id)) } fn path_global(&self, span: Span, strs: Vec<ast::Ident> ) -> ast::Path { - self.path_all(span, true, strs, opt_vec::Empty, Vec::new()) + self.path_all(span, true, strs, Vec::new(), Vec::new()) } fn path_all(&self, sp: Span, global: bool, mut idents: Vec<ast::Ident> , - lifetimes: OptVec<ast::Lifetime>, + lifetimes: Vec<ast::Lifetime>, types: Vec<P<ast::Ty>> ) -> ast::Path { let last_identifier = idents.pop().unwrap(); @@ -275,7 +275,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { .map(|ident| { ast::PathSegment { identifier: ident, - lifetimes: opt_vec::Empty, + lifetimes: Vec::new(), types: opt_vec::Empty, } }).collect(); @@ -342,7 +342,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { self.ident_of("option"), self.ident_of("Option") ), - opt_vec::Empty, + Vec::new(), vec!( ty )), None) } diff --git a/src/libsyntax/ext/concat_idents.rs b/src/libsyntax/ext/concat_idents.rs index 25525869398..ee3adb7aad8 100644 --- a/src/libsyntax/ext/concat_idents.rs +++ b/src/libsyntax/ext/concat_idents.rs @@ -15,6 +15,7 @@ use ext::base; use opt_vec; use parse::token; use parse::token::{str_to_ident}; +use std::vec_ng::Vec; pub fn expand_syntax_ext(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) -> base::MacResult { @@ -51,7 +52,7 @@ pub fn expand_syntax_ext(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) segments: vec!( ast::PathSegment { identifier: res, - lifetimes: opt_vec::Empty, + lifetimes: Vec::new(), types: opt_vec::Empty, } ) diff --git a/src/libsyntax/ext/deriving/rand.rs b/src/libsyntax/ext/deriving/rand.rs index 2d16c87b78b..b8ef9d98b29 100644 --- a/src/libsyntax/ext/deriving/rand.rs +++ b/src/libsyntax/ext/deriving/rand.rs @@ -14,7 +14,6 @@ use codemap::Span; use ext::base::ExtCtxt; use ext::build::{AstBuilder}; use ext::deriving::generic::*; -use opt_vec; use std::vec_ng::Vec; @@ -84,7 +83,7 @@ fn rand_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) let rand_name = cx.path_all(trait_span, true, rand_ident.clone(), - opt_vec::Empty, + Vec::new(), Vec::new()); let rand_name = cx.expr_path(rand_name); diff --git a/src/libsyntax/ext/deriving/ty.rs b/src/libsyntax/ext/deriving/ty.rs index b88cd117911..60166f30f1e 100644 --- a/src/libsyntax/ext/deriving/ty.rs +++ b/src/libsyntax/ext/deriving/ty.rs @@ -19,7 +19,6 @@ use ext::base::ExtCtxt; use ext::build::AstBuilder; use codemap::{Span,respan}; use opt_vec; -use opt_vec::OptVec; use std::vec_ng::Vec; @@ -118,11 +117,12 @@ fn mk_lifetime(cx: &ExtCtxt, span: Span, lt: &Option<&str>) -> Option<ast::Lifet } } -fn mk_lifetimes(cx: &ExtCtxt, span: Span, lt: &Option<&str>) -> OptVec<ast::Lifetime> { - match *lt { +fn mk_lifetimes(cx: &ExtCtxt, span: Span, lt: &Option<&str>) -> Vec<ast::Lifetime> { + let lifetimes = match *lt { Some(ref s) => opt_vec::with(cx.lifetime(span, cx.ident_of(*s).name)), None => opt_vec::Empty - } + }; + opt_vec::take_vec(lifetimes) } impl<'a> Ty<'a> { @@ -199,7 +199,7 @@ fn mk_ty_param(cx: &ExtCtxt, span: Span, name: &str, bounds: &[Path], fn mk_generics(lifetimes: Vec<ast::Lifetime> , ty_params: Vec<ast::TyParam> ) -> Generics { Generics { - lifetimes: opt_vec::from(lifetimes), + lifetimes: lifetimes, ty_params: opt_vec::from(ty_params) } } diff --git a/src/libsyntax/ext/env.rs b/src/libsyntax/ext/env.rs index b0b5fa26015..0c7b92d0373 100644 --- a/src/libsyntax/ext/env.rs +++ b/src/libsyntax/ext/env.rs @@ -19,10 +19,10 @@ use codemap::Span; use ext::base::*; use ext::base; use ext::build::AstBuilder; -use opt_vec; use parse::token; use std::os; +use std::vec_ng::Vec; pub fn expand_option_env(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) -> base::MacResult { @@ -38,7 +38,7 @@ pub fn expand_option_env(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) vec!(cx.ident_of("std"), cx.ident_of("option"), cx.ident_of("None")), - opt_vec::Empty, + Vec::new(), vec!(cx.ty_rptr(sp, cx.ty_ident(sp, cx.ident_of("str")), diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs index b27ea3df21e..0db948c30b7 100644 --- a/src/libsyntax/ext/format.rs +++ b/src/libsyntax/ext/format.rs @@ -14,7 +14,6 @@ use codemap::{Span, respan}; use ext::base::*; use ext::base; use ext::build::AstBuilder; -use opt_vec; use parse::token::InternedString; use parse::token; use rsparse = parse; @@ -509,7 +508,7 @@ impl<'a> Context<'a> { sp, true, self.rtpath("Method"), - opt_vec::with(life), + vec!(life), Vec::new() ), None); let st = ast::ItemStatic(ty, ast::MutImmutable, method); @@ -632,8 +631,8 @@ impl<'a> Context<'a> { self.ecx.ident_of("fmt"), self.ecx.ident_of("rt"), self.ecx.ident_of("Piece")), - opt_vec::with( - self.ecx.lifetime(self.fmtsp, self.ecx.ident_of("static").name)), + vec!(self.ecx.lifetime(self.fmtsp, + self.ecx.ident_of("static").name)), Vec::new() ), None); let ty = ast::TyFixedLengthVec( diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 99e7b6a7ab1..0b56cd07c88 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -439,8 +439,8 @@ pub fn fold_lifetime<T: Folder>(l: &Lifetime, fld: &mut T) -> Lifetime { } } -pub fn fold_lifetimes<T: Folder>(lts: &OptVec<Lifetime>, fld: &mut T) - -> OptVec<Lifetime> { +pub fn fold_lifetimes<T: Folder>(lts: &Vec<Lifetime>, fld: &mut T) + -> Vec<Lifetime> { lts.map(|l| fold_lifetime(l, fld)) } diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index b6f813269cf..cb49ad0905c 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -556,7 +556,7 @@ mod test { segments: vec!( ast::PathSegment { identifier: str_to_ident("d"), - lifetimes: opt_vec::Empty, + lifetimes: Vec::new(), types: opt_vec::Empty, } ), @@ -578,7 +578,7 @@ mod test { segments: vec!( ast::PathSegment { identifier: str_to_ident("b"), - lifetimes: opt_vec::Empty, + lifetimes: Vec::new(), types: opt_vec::Empty, } ), @@ -605,7 +605,7 @@ mod test { segments: vec!( ast::PathSegment { identifier: str_to_ident("b"), - lifetimes: opt_vec::Empty, + lifetimes: Vec::new(), types: opt_vec::Empty, } ), @@ -633,7 +633,7 @@ mod test { ast::PathSegment { identifier: str_to_ident("int"), - lifetimes: opt_vec::Empty, + lifetimes: Vec::new(), types: opt_vec::Empty, } ), @@ -651,7 +651,7 @@ mod test { ast::PathSegment { identifier: str_to_ident("b"), - lifetimes: opt_vec::Empty, + lifetimes: Vec::new(), types: opt_vec::Empty, } ), @@ -671,7 +671,7 @@ mod test { ast::ImpureFn, abi::AbiSet::Rust(), ast::Generics{ // no idea on either of these: - lifetimes: opt_vec::Empty, + lifetimes: Vec::new(), ty_params: opt_vec::Empty, }, ast::P(ast::Block { @@ -689,7 +689,7 @@ mod test { str_to_ident( "b"), lifetimes: - opt_vec::Empty, + Vec::new(), types: opt_vec::Empty } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index f80fc78b79c..7760ca89eb2 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -958,7 +958,7 @@ impl Parser { lifetimes } else { - opt_vec::Empty + Vec::new() }; let inputs = if self.eat(&token::OROR) { @@ -1015,7 +1015,7 @@ impl Parser { // parse a function type (following the 'fn') pub fn parse_ty_fn_decl(&mut self, allow_variadic: bool) - -> (P<FnDecl>, OptVec<ast::Lifetime>) { + -> (P<FnDecl>, Vec<ast::Lifetime>) { /* (fn) <'lt> (S) -> T @@ -1031,7 +1031,7 @@ impl Parser { self.expect_gt(); lifetimes } else { - opt_vec::Empty + Vec::new() }; let (inputs, variadic) = self.parse_fn_args(false, allow_variadic); @@ -1510,7 +1510,7 @@ impl Parser { segments.push(PathSegmentAndBoundSet { segment: ast::PathSegment { identifier: identifier, - lifetimes: opt_vec::Empty, + lifetimes: Vec::new(), types: opt_vec::Empty, }, bound_set: bound_set @@ -1525,7 +1525,7 @@ impl Parser { self.parse_generic_values_after_lt(); (true, lifetimes, opt_vec::from(types)) } else { - (false, opt_vec::Empty, opt_vec::Empty) + (false, Vec::new(), opt_vec::Empty) } }; @@ -1621,7 +1621,7 @@ impl Parser { // matches lifetimes = ( lifetime ) | ( lifetime , lifetimes ) // actually, it matches the empty one too, but putting that in there // messes up the grammar.... - pub fn parse_lifetimes(&mut self) -> OptVec<ast::Lifetime> { + pub fn parse_lifetimes(&mut self) -> Vec<ast::Lifetime> { /*! * * Parses zero or more comma separated lifetimes. @@ -1630,7 +1630,7 @@ impl Parser { * lists, where we expect something like `<'a, 'b, T>`. */ - let mut res = opt_vec::Empty; + let mut res = Vec::new(); loop { match self.token { token::LIFETIME(_) => { @@ -1995,7 +1995,7 @@ impl Parser { self.expect(&token::LT); self.parse_generic_values_after_lt() } else { - (opt_vec::Empty, Vec::new()) + (Vec::new(), Vec::new()) }; // expr.f() method call @@ -3515,7 +3515,7 @@ impl Parser { } } - fn parse_generic_values_after_lt(&mut self) -> (OptVec<ast::Lifetime>, Vec<P<Ty>> ) { + fn parse_generic_values_after_lt(&mut self) -> (Vec<ast::Lifetime>, Vec<P<Ty>> ) { let lifetimes = self.parse_lifetimes(); let result = self.parse_seq_to_gt( Some(token::COMMA), @@ -4886,7 +4886,7 @@ impl Parser { segments: path.move_iter().map(|identifier| { ast::PathSegment { identifier: identifier, - lifetimes: opt_vec::Empty, + lifetimes: Vec::new(), types: opt_vec::Empty, } }).collect() @@ -4921,7 +4921,7 @@ impl Parser { segments: path.move_iter().map(|identifier| { ast::PathSegment { identifier: identifier, - lifetimes: opt_vec::Empty, + lifetimes: Vec::new(), types: opt_vec::Empty, } }).collect() @@ -4939,7 +4939,7 @@ impl Parser { segments: path.move_iter().map(|identifier| { ast::PathSegment { identifier: identifier, - lifetimes: opt_vec::Empty, + lifetimes: Vec::new(), types: opt_vec::Empty, } }).collect() @@ -4961,7 +4961,7 @@ impl Parser { segments: path.move_iter().map(|identifier| { ast::PathSegment { identifier: identifier, - lifetimes: opt_vec::Empty, + lifetimes: Vec::new(), types: opt_vec::Empty, } }).collect() diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index f8a07599420..538528fb148 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -15,6 +15,7 @@ use codemap::Span; use parse; use opt_vec; use opt_vec::OptVec; +use std::vec_ng::Vec; // Context-passing AST walker. Each overridden visit method has full control // over what happens with its node, it can do its own traversal of the node's @@ -55,7 +56,7 @@ pub fn generics_of_fn(fk: &FnKind) -> Generics { } FkFnBlock(..) => { Generics { - lifetimes: opt_vec::Empty, + lifetimes: Vec::new(), ty_params: opt_vec::Empty, } } @@ -370,7 +371,7 @@ pub fn walk_ty<E: Clone, V: Visitor<E>>(visitor: &mut V, typ: &Ty, env: E) { } fn walk_lifetime_decls<E: Clone, V: Visitor<E>>(visitor: &mut V, - lifetimes: &OptVec<Lifetime>, + lifetimes: &Vec<Lifetime>, env: E) { for l in lifetimes.iter() { visitor.visit_lifetime_decl(l, env.clone()); |
