Rename ast::GenericParam and ast::GenericArg

It's so confusing to have everything having the same name, at least while refactoring.
This commit is contained in:
varkor 2018-05-25 18:41:03 +01:00
parent f9d0968906
commit d643946550
22 changed files with 123 additions and 124 deletions

View file

@ -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<GenericParam>)
-> PResult<'a, TyKind> {
fn parse_ty_bare_fn(&mut self, generic_params: Vec<GenericParamAST>) -> 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<GenericParam>, path: ast::Path,
fn parse_remaining_bounds(&mut self, generic_params: Vec<GenericParamAST>, 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<ast::GenericParam>> {
crate fn parse_generic_params(&mut self) -> PResult<'a, Vec<ast::GenericParamAST>> {
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<GenericArg>, Vec<TypeBinding>)> {
-> PResult<'a, (Vec<GenericArgAST>, Vec<TypeBinding>)> {
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<GenericParam>> {
fn parse_late_bound_lifetime_defs(&mut self) -> PResult<'a, Vec<GenericParamAST>> {
if self.eat_keyword(keywords::For) {
self.expect_lt()?;
let params = self.parse_generic_params()?;