From d643946550fa349729184a4f70abc01e21ceddc0 Mon Sep 17 00:00:00 2001 From: varkor Date: Fri, 25 May 2018 18:41:03 +0100 Subject: Rename ast::GenericParam and ast::GenericArg It's so confusing to have everything having the same name, at least while refactoring. --- src/libsyntax/parse/parser.rs | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'src/libsyntax/parse') diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index a51b3bc0ae4..be4a4b8b11f 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -21,8 +21,8 @@ use ast::EnumDef; use ast::{Expr, ExprKind, RangeLimits}; use ast::{Field, FnDecl}; use ast::{ForeignItem, ForeignItemKind, FunctionRetTy}; -use ast::GenericParam; -use ast::GenericArg; +use ast::GenericParamAST; +use ast::GenericArgAST; use ast::{Ident, ImplItem, IsAuto, Item, ItemKind}; use ast::{Label, Lifetime, LifetimeDef, Lit, LitKind}; use ast::Local; @@ -1246,8 +1246,7 @@ impl<'a> Parser<'a> { } /// parse a TyKind::BareFn type: - fn parse_ty_bare_fn(&mut self, generic_params: Vec) - -> PResult<'a, TyKind> { + fn parse_ty_bare_fn(&mut self, generic_params: Vec) -> PResult<'a, TyKind> { /* [unsafe] [extern "ABI"] fn (S) -> T @@ -1566,7 +1565,7 @@ impl<'a> Parser<'a> { Ok(P(ty)) } - fn parse_remaining_bounds(&mut self, generic_params: Vec, path: ast::Path, + fn parse_remaining_bounds(&mut self, generic_params: Vec, path: ast::Path, lo: Span, parse_plus: bool) -> PResult<'a, TyKind> { let poly_trait_ref = PolyTraitRef::new(generic_params, path, lo.to(self.prev_span)); let mut bounds = vec![TraitTyParamBound(poly_trait_ref, TraitBoundModifier::None)]; @@ -4864,7 +4863,7 @@ impl<'a> Parser<'a> { /// Parses (possibly empty) list of lifetime and type parameters, possibly including /// trailing comma and erroneous trailing attributes. - crate fn parse_generic_params(&mut self) -> PResult<'a, Vec> { + crate fn parse_generic_params(&mut self) -> PResult<'a, Vec> { let mut params = Vec::new(); let mut seen_ty_param = false; loop { @@ -4877,7 +4876,7 @@ impl<'a> Parser<'a> { } else { Vec::new() }; - params.push(ast::GenericParam::Lifetime(LifetimeDef { + params.push(ast::GenericParamAST::Lifetime(LifetimeDef { attrs: attrs.into(), lifetime, bounds, @@ -4888,7 +4887,7 @@ impl<'a> Parser<'a> { } } else if self.check_ident() { // Parse type parameter. - params.push(ast::GenericParam::Type(self.parse_ty_param(attrs)?)); + params.push(ast::GenericParamAST::Type(self.parse_ty_param(attrs)?)); seen_ty_param = true; } else { // Check for trailing attributes and stop parsing. @@ -4938,7 +4937,7 @@ impl<'a> Parser<'a> { /// Parses (possibly empty) list of lifetime and type arguments and associated type bindings, /// possibly including trailing comma. fn parse_generic_args(&mut self) - -> PResult<'a, (Vec, Vec)> { + -> PResult<'a, (Vec, Vec)> { let mut args = Vec::new(); let mut bindings = Vec::new(); let mut seen_type = false; @@ -4946,7 +4945,7 @@ impl<'a> Parser<'a> { loop { if self.check_lifetime() && self.look_ahead(1, |t| !t.is_like_plus()) { // Parse lifetime argument. - args.push(GenericArg::Lifetime(self.expect_lifetime())); + args.push(GenericArgAST::Lifetime(self.expect_lifetime())); if seen_type || seen_binding { self.span_err(self.prev_span, "lifetime parameters must be declared prior to type parameters"); @@ -4971,7 +4970,7 @@ impl<'a> Parser<'a> { self.span_err(ty_param.span, "type parameters must be declared prior to associated type bindings"); } - args.push(GenericArg::Type(ty_param)); + args.push(GenericArgAST::Type(ty_param)); seen_type = true; } else { break @@ -5693,7 +5692,7 @@ impl<'a> Parser<'a> { Ok((keywords::Invalid.ident(), item_kind, Some(attrs))) } - fn parse_late_bound_lifetime_defs(&mut self) -> PResult<'a, Vec> { + fn parse_late_bound_lifetime_defs(&mut self) -> PResult<'a, Vec> { if self.eat_keyword(keywords::For) { self.expect_lt()?; let params = self.parse_generic_params()?; -- cgit 1.4.1-3-g733a5