Type field renames
diff --git a/src/gen/fold.rs b/src/gen/fold.rs
index b052989..cf93016 100644
--- a/src/gen/fold.rs
+++ b/src/gen/fold.rs
@@ -2450,9 +2450,9 @@
pub fn fold_type_array<V: Folder + ?Sized>(_visitor: &mut V, _i: TypeArray) -> TypeArray {
TypeArray {
bracket_token: Bracket(tokens_helper(_visitor, &(_i . bracket_token).0)),
- ty: Box::new(_visitor.fold_type(* _i . ty)),
+ elem: Box::new(_visitor.fold_type(* _i . elem)),
semi_token: Token ! [ ; ](tokens_helper(_visitor, &(_i . semi_token).0)),
- amt: _visitor.fold_expr(_i . amt),
+ len: _visitor.fold_expr(_i . len),
}
}
@@ -2473,7 +2473,7 @@
pub fn fold_type_group<V: Folder + ?Sized>(_visitor: &mut V, _i: TypeGroup) -> TypeGroup {
TypeGroup {
group_token: Group(tokens_helper(_visitor, &(_i . group_token).0)),
- ty: Box::new(_visitor.fold_type(* _i . ty)),
+ elem: Box::new(_visitor.fold_type(* _i . elem)),
}
}
@@ -2527,7 +2527,7 @@
pub fn fold_type_paren<V: Folder + ?Sized>(_visitor: &mut V, _i: TypeParen) -> TypeParen {
TypeParen {
paren_token: Paren(tokens_helper(_visitor, &(_i . paren_token).0)),
- ty: Box::new(_visitor.fold_type(* _i . ty)),
+ elem: Box::new(_visitor.fold_type(* _i . elem)),
}
}
@@ -2542,7 +2542,7 @@
TypePtr {
star_token: Token ! [ * ](tokens_helper(_visitor, &(_i . star_token).0)),
const_token: (_i . const_token).map(|it| { Token ! [ const ](tokens_helper(_visitor, &(it).0)) }),
- ty: Box::new(_visitor.fold_mut_type(* _i . ty)),
+ elem: Box::new(_visitor.fold_mut_type(* _i . elem)),
}
}
@@ -2550,14 +2550,14 @@
TypeReference {
and_token: Token ! [ & ](tokens_helper(_visitor, &(_i . and_token).0)),
lifetime: (_i . lifetime).map(|it| { _visitor.fold_lifetime(it) }),
- ty: Box::new(_visitor.fold_mut_type(* _i . ty)),
+ elem: Box::new(_visitor.fold_mut_type(* _i . elem)),
}
}
pub fn fold_type_slice<V: Folder + ?Sized>(_visitor: &mut V, _i: TypeSlice) -> TypeSlice {
TypeSlice {
bracket_token: Bracket(tokens_helper(_visitor, &(_i . bracket_token).0)),
- ty: Box::new(_visitor.fold_type(* _i . ty)),
+ elem: Box::new(_visitor.fold_type(* _i . elem)),
}
}
@@ -2571,7 +2571,7 @@
pub fn fold_type_tuple<V: Folder + ?Sized>(_visitor: &mut V, _i: TypeTuple) -> TypeTuple {
TypeTuple {
paren_token: Paren(tokens_helper(_visitor, &(_i . paren_token).0)),
- tys: FoldHelper::lift(_i . tys, |it| { _visitor.fold_type(it) }),
+ elems: FoldHelper::lift(_i . elems, |it| { _visitor.fold_type(it) }),
}
}
diff --git a/src/gen/visit.rs b/src/gen/visit.rs
index e06c758..4991eb2 100644
--- a/src/gen/visit.rs
+++ b/src/gen/visit.rs
@@ -1904,9 +1904,9 @@
pub fn visit_type_array<'ast, V: Visitor<'ast> + ?Sized>(_visitor: &mut V, _i: &'ast TypeArray) {
tokens_helper(_visitor, &(& _i . bracket_token).0);
- _visitor.visit_type(& * _i . ty);
+ _visitor.visit_type(& * _i . elem);
tokens_helper(_visitor, &(& _i . semi_token).0);
- _visitor.visit_expr(& _i . amt);
+ _visitor.visit_expr(& _i . len);
}
pub fn visit_type_bare_fn<'ast, V: Visitor<'ast> + ?Sized>(_visitor: &mut V, _i: &'ast TypeBareFn) {
@@ -1921,7 +1921,7 @@
pub fn visit_type_group<'ast, V: Visitor<'ast> + ?Sized>(_visitor: &mut V, _i: &'ast TypeGroup) {
tokens_helper(_visitor, &(& _i . group_token).0);
- _visitor.visit_type(& * _i . ty);
+ _visitor.visit_type(& * _i . elem);
}
pub fn visit_type_impl_trait<'ast, V: Visitor<'ast> + ?Sized>(_visitor: &mut V, _i: &'ast TypeImplTrait) {
@@ -1961,7 +1961,7 @@
pub fn visit_type_paren<'ast, V: Visitor<'ast> + ?Sized>(_visitor: &mut V, _i: &'ast TypeParen) {
tokens_helper(_visitor, &(& _i . paren_token).0);
- _visitor.visit_type(& * _i . ty);
+ _visitor.visit_type(& * _i . elem);
}
pub fn visit_type_path<'ast, V: Visitor<'ast> + ?Sized>(_visitor: &mut V, _i: &'ast TypePath) {
@@ -1972,18 +1972,18 @@
pub fn visit_type_ptr<'ast, V: Visitor<'ast> + ?Sized>(_visitor: &mut V, _i: &'ast TypePtr) {
tokens_helper(_visitor, &(& _i . star_token).0);
if let Some(ref it) = _i . const_token { tokens_helper(_visitor, &(it).0) };
- _visitor.visit_mut_type(& * _i . ty);
+ _visitor.visit_mut_type(& * _i . elem);
}
pub fn visit_type_reference<'ast, V: Visitor<'ast> + ?Sized>(_visitor: &mut V, _i: &'ast TypeReference) {
tokens_helper(_visitor, &(& _i . and_token).0);
if let Some(ref it) = _i . lifetime { _visitor.visit_lifetime(it) };
- _visitor.visit_mut_type(& * _i . ty);
+ _visitor.visit_mut_type(& * _i . elem);
}
pub fn visit_type_slice<'ast, V: Visitor<'ast> + ?Sized>(_visitor: &mut V, _i: &'ast TypeSlice) {
tokens_helper(_visitor, &(& _i . bracket_token).0);
- _visitor.visit_type(& * _i . ty);
+ _visitor.visit_type(& * _i . elem);
}
pub fn visit_type_trait_object<'ast, V: Visitor<'ast> + ?Sized>(_visitor: &mut V, _i: &'ast TypeTraitObject) {
@@ -1993,7 +1993,7 @@
pub fn visit_type_tuple<'ast, V: Visitor<'ast> + ?Sized>(_visitor: &mut V, _i: &'ast TypeTuple) {
tokens_helper(_visitor, &(& _i . paren_token).0);
- for el in & _i . tys { let it = el.item(); _visitor.visit_type(it) };
+ for el in & _i . elems { let it = el.item(); _visitor.visit_type(it) };
}
pub fn visit_un_op<'ast, V: Visitor<'ast> + ?Sized>(_visitor: &mut V, _i: &'ast UnOp) {
diff --git a/src/gen/visit_mut.rs b/src/gen/visit_mut.rs
index 34543d7..c20a220 100644
--- a/src/gen/visit_mut.rs
+++ b/src/gen/visit_mut.rs
@@ -1904,9 +1904,9 @@
pub fn visit_type_array_mut<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TypeArray) {
tokens_helper(_visitor, &mut (& mut _i . bracket_token).0);
- _visitor.visit_type_mut(& mut * _i . ty);
+ _visitor.visit_type_mut(& mut * _i . elem);
tokens_helper(_visitor, &mut (& mut _i . semi_token).0);
- _visitor.visit_expr_mut(& mut _i . amt);
+ _visitor.visit_expr_mut(& mut _i . len);
}
pub fn visit_type_bare_fn_mut<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TypeBareFn) {
@@ -1921,7 +1921,7 @@
pub fn visit_type_group_mut<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TypeGroup) {
tokens_helper(_visitor, &mut (& mut _i . group_token).0);
- _visitor.visit_type_mut(& mut * _i . ty);
+ _visitor.visit_type_mut(& mut * _i . elem);
}
pub fn visit_type_impl_trait_mut<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TypeImplTrait) {
@@ -1961,7 +1961,7 @@
pub fn visit_type_paren_mut<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TypeParen) {
tokens_helper(_visitor, &mut (& mut _i . paren_token).0);
- _visitor.visit_type_mut(& mut * _i . ty);
+ _visitor.visit_type_mut(& mut * _i . elem);
}
pub fn visit_type_path_mut<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TypePath) {
@@ -1972,18 +1972,18 @@
pub fn visit_type_ptr_mut<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TypePtr) {
tokens_helper(_visitor, &mut (& mut _i . star_token).0);
if let Some(ref mut it) = _i . const_token { tokens_helper(_visitor, &mut (it).0) };
- _visitor.visit_mut_type_mut(& mut * _i . ty);
+ _visitor.visit_mut_type_mut(& mut * _i . elem);
}
pub fn visit_type_reference_mut<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TypeReference) {
tokens_helper(_visitor, &mut (& mut _i . and_token).0);
if let Some(ref mut it) = _i . lifetime { _visitor.visit_lifetime_mut(it) };
- _visitor.visit_mut_type_mut(& mut * _i . ty);
+ _visitor.visit_mut_type_mut(& mut * _i . elem);
}
pub fn visit_type_slice_mut<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TypeSlice) {
tokens_helper(_visitor, &mut (& mut _i . bracket_token).0);
- _visitor.visit_type_mut(& mut * _i . ty);
+ _visitor.visit_type_mut(& mut * _i . elem);
}
pub fn visit_type_trait_object_mut<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TypeTraitObject) {
@@ -1993,7 +1993,7 @@
pub fn visit_type_tuple_mut<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut TypeTuple) {
tokens_helper(_visitor, &mut (& mut _i . paren_token).0);
- for mut el in & mut _i . tys { let it = el.item_mut(); _visitor.visit_type_mut(it) };
+ for mut el in & mut _i . elems { let it = el.item_mut(); _visitor.visit_type_mut(it) };
}
pub fn visit_un_op_mut<V: VisitorMut + ?Sized>(_visitor: &mut V, _i: &mut UnOp) {
diff --git a/src/ty.rs b/src/ty.rs
index 01fd7bc..ed18f25 100644
--- a/src/ty.rs
+++ b/src/ty.rs
@@ -7,26 +7,26 @@
/// A variable-length array (`[T]`)
pub Slice(TypeSlice {
pub bracket_token: token::Bracket,
- pub ty: Box<Type>,
+ pub elem: Box<Type>,
}),
/// A fixed length array (`[T; n]`)
pub Array(TypeArray {
pub bracket_token: token::Bracket,
- pub ty: Box<Type>,
+ pub elem: Box<Type>,
pub semi_token: Token![;],
- pub amt: Expr,
+ pub len: Expr,
}),
/// A raw pointer (`*const T` or `*mut T`)
pub Ptr(TypePtr {
pub star_token: Token![*],
pub const_token: Option<Token![const]>,
- pub ty: Box<MutType>,
+ pub elem: Box<MutType>,
}),
/// A reference (`&'a T` or `&'a mut T`)
pub Reference(TypeReference {
pub and_token: Token![&],
pub lifetime: Option<Lifetime>,
- pub ty: Box<MutType>,
+ pub elem: Box<MutType>,
}),
/// A bare function (e.g. `fn(usize) -> bool`)
pub BareFn(TypeBareFn {
@@ -39,7 +39,7 @@
/// A tuple (`(A, B, C, D, ...)`)
pub Tuple(TypeTuple {
pub paren_token: token::Paren,
- pub tys: Delimited<Type, Token![,]>,
+ pub elems: Delimited<Type, Token![,]>,
}),
/// A path (`module::module::...::Type`), optionally
/// "qualified", e.g. `<Vec<T> as SomeTrait>::SomeType`.
@@ -64,12 +64,12 @@
/// No-op; kept solely so that we can pretty-print faithfully
pub Paren(TypeParen {
pub paren_token: token::Paren,
- pub ty: Box<Type>,
+ pub elem: Box<Type>,
}),
/// No-op: kept solely so that we can pretty-print faithfully
pub Group(TypeGroup {
pub group_token: token::Group,
- pub ty: Box<Type>,
+ pub elem: Box<Type>,
}),
/// TypeKind::Infer means the type should be inferred instead of it having been
/// specified. This can appear anywhere in a type.
@@ -386,7 +386,7 @@
named!(parse -> Self, map!(
brackets!(syn!(Type)),
|(ty, b)| TypeSlice {
- ty: Box::new(ty),
+ elem: Box::new(ty),
bracket_token: b,
}
));
@@ -402,8 +402,8 @@
)),
|((elem, semi, len), brackets)| {
TypeArray {
- ty: Box::new(elem),
- amt: len,
+ elem: Box::new(elem),
+ len: len,
bracket_token: brackets,
semi_token: semi,
}
@@ -423,7 +423,7 @@
(TypePtr {
const_token: mutability.1,
star_token: star,
- ty: Box::new(MutType {
+ elem: Box::new(MutType {
ty: target,
mutability: mutability.0,
}),
@@ -440,7 +440,7 @@
target: call!(Type::without_plus) >>
(TypeReference {
lifetime: life,
- ty: Box::new(MutType {
+ elem: Box::new(MutType {
ty: target,
mutability: mutability,
}),
@@ -495,7 +495,7 @@
named!(parse -> Self, do_parse!(
data: parens!(call!(Delimited::parse_terminated)) >>
(TypeTuple {
- tys: data.0,
+ elems: data.0,
paren_token: data.1,
})
));
@@ -620,7 +620,7 @@
data: grouped!(syn!(Type)) >>
(TypeGroup {
group_token: data.1,
- ty: Box::new(data.0),
+ elem: Box::new(data.0),
})
));
}
@@ -630,7 +630,7 @@
data: parens!(syn!(Type)) >>
(TypeParen {
paren_token: data.1,
- ty: Box::new(data.0),
+ elem: Box::new(data.0),
})
));
}
@@ -817,7 +817,7 @@
impl ToTokens for TypeSlice {
fn to_tokens(&self, tokens: &mut Tokens) {
self.bracket_token.surround(tokens, |tokens| {
- self.ty.to_tokens(tokens);
+ self.elem.to_tokens(tokens);
});
}
}
@@ -825,9 +825,9 @@
impl ToTokens for TypeArray {
fn to_tokens(&self, tokens: &mut Tokens) {
self.bracket_token.surround(tokens, |tokens| {
- self.ty.to_tokens(tokens);
+ self.elem.to_tokens(tokens);
self.semi_token.to_tokens(tokens);
- self.amt.to_tokens(tokens);
+ self.len.to_tokens(tokens);
});
}
}
@@ -835,13 +835,13 @@
impl ToTokens for TypePtr {
fn to_tokens(&self, tokens: &mut Tokens) {
self.star_token.to_tokens(tokens);
- match self.ty.mutability {
+ match self.elem.mutability {
Some(ref tok) => tok.to_tokens(tokens),
None => {
TokensOrDefault(&self.const_token).to_tokens(tokens);
}
}
- self.ty.ty.to_tokens(tokens);
+ self.elem.ty.to_tokens(tokens);
}
}
@@ -849,8 +849,8 @@
fn to_tokens(&self, tokens: &mut Tokens) {
self.and_token.to_tokens(tokens);
self.lifetime.to_tokens(tokens);
- self.ty.mutability.to_tokens(tokens);
- self.ty.ty.to_tokens(tokens);
+ self.elem.mutability.to_tokens(tokens);
+ self.elem.ty.to_tokens(tokens);
}
}
@@ -869,7 +869,7 @@
impl ToTokens for TypeTuple {
fn to_tokens(&self, tokens: &mut Tokens) {
self.paren_token.surround(tokens, |tokens| {
- self.tys.to_tokens(tokens);
+ self.elems.to_tokens(tokens);
})
}
}
@@ -935,7 +935,7 @@
impl ToTokens for TypeGroup {
fn to_tokens(&self, tokens: &mut Tokens) {
self.group_token.surround(tokens, |tokens| {
- self.ty.to_tokens(tokens);
+ self.elem.to_tokens(tokens);
});
}
}
@@ -943,7 +943,7 @@
impl ToTokens for TypeParen {
fn to_tokens(&self, tokens: &mut Tokens) {
self.paren_token.surround(tokens, |tokens| {
- self.ty.to_tokens(tokens);
+ self.elem.to_tokens(tokens);
});
}
}