Skip to content

Commit d09220d

Browse files
committed
rename ast::ImplItem_::*ImplItem to ast::ImplItemKind::*
1 parent e36872d commit d09220d

File tree

12 files changed

+47
-48
lines changed

12 files changed

+47
-48
lines changed

src/librustc/front/map/blocks.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ impl<'a> FnLikeNode<'a> {
236236
},
237237
map::NodeImplItem(ii) => {
238238
match ii.node {
239-
ast::ImplItem_::Method(ref sig, ref body) => {
239+
ast::ImplItemKind::Method(ref sig, ref body) => {
240240
method(ii.id, ii.name, sig, Some(ii.vis), body, ii.span)
241241
}
242242
_ => {

src/librustc_driver/pretty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ impl fold::Folder for ReplaceBodyWithLoop {
623623

624624
fn fold_impl_item(&mut self, i: P<ast::ImplItem>) -> SmallVector<P<ast::ImplItem>> {
625625
match i.node {
626-
ast::ConstImplItem(..) => {
626+
ast::ImplItemKind::Const(..) => {
627627
self.within_static_or_const = true;
628628
let ret = fold::noop_fold_impl_item(i, self);
629629
self.within_static_or_const = false;

src/librustc_front/lowering.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -675,14 +675,14 @@ pub fn lower_impl_item(_lctx: &LoweringContext, i: &ImplItem) -> P<hir::ImplItem
675675
attrs: i.attrs.clone(),
676676
vis: lower_visibility(_lctx, i.vis),
677677
node: match i.node {
678-
ConstImplItem(ref ty, ref expr) => {
678+
ImplItemKind::Const(ref ty, ref expr) => {
679679
hir::ImplItemKind::Const(lower_ty(_lctx, ty), lower_expr(_lctx, expr))
680680
}
681-
MethodImplItem(ref sig, ref body) => {
681+
ImplItemKind::Method(ref sig, ref body) => {
682682
hir::ImplItemKind::Method(lower_method_sig(_lctx, sig), lower_block(_lctx, body))
683683
}
684-
TypeImplItem(ref ty) => hir::ImplItemKind::Type(lower_ty(_lctx, ty)),
685-
MacImplItem(..) => panic!("Shouldn't exist any more"),
684+
ImplItemKind::Type(ref ty) => hir::ImplItemKind::Type(lower_ty(_lctx, ty)),
685+
ImplItemKind::Macro(..) => panic!("Shouldn't exist any more"),
686686
},
687687
span: i.span,
688688
})

src/librustc_trans/save/dump_csv.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -992,22 +992,22 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
992992

993993
fn visit_impl_item(&mut self, impl_item: &ast::ImplItem) {
994994
match impl_item.node {
995-
ast::ConstImplItem(ref ty, ref expr) => {
995+
ast::ImplItemKind::Const(ref ty, ref expr) => {
996996
self.process_const(impl_item.id,
997997
impl_item.ident.name,
998998
impl_item.span,
999999
&ty,
10001000
&expr);
10011001
}
1002-
ast::MethodImplItem(ref sig, ref body) => {
1002+
ast::ImplItemKind::Method(ref sig, ref body) => {
10031003
self.process_method(sig,
10041004
Some(body),
10051005
impl_item.id,
10061006
impl_item.ident.name,
10071007
impl_item.span);
10081008
}
1009-
ast::TypeImplItem(_) |
1010-
ast::MacImplItem(_) => {}
1009+
ast::ImplItemKind::Type(_) |
1010+
ast::ImplItemKind::Macro(_) => {}
10111011
}
10121012
}
10131013

src/libsyntax/ast.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ pub use self::Expr_::*;
2020
pub use self::FloatTy::*;
2121
pub use self::FunctionRetTy::*;
2222
pub use self::ForeignItem_::*;
23-
pub use self::ImplItem_::*;
2423
pub use self::IntTy::*;
2524
pub use self::Item_::*;
2625
pub use self::KleeneOp::*;
@@ -1230,16 +1229,16 @@ pub struct ImplItem {
12301229
pub ident: Ident,
12311230
pub vis: Visibility,
12321231
pub attrs: Vec<Attribute>,
1233-
pub node: ImplItem_,
1232+
pub node: ImplItemKind,
12341233
pub span: Span,
12351234
}
12361235

12371236
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
1238-
pub enum ImplItem_ {
1239-
ConstImplItem(P<Ty>, P<Expr>),
1240-
MethodImplItem(MethodSig, P<Block>),
1241-
TypeImplItem(P<Ty>),
1242-
MacImplItem(Mac),
1237+
pub enum ImplItemKind {
1238+
Const(P<Ty>, P<Expr>),
1239+
Method(MethodSig, P<Block>),
1240+
Type(P<Ty>),
1241+
Macro(Mac),
12431242
}
12441243

12451244
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]

src/libsyntax/ext/deriving/generic/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ impl<'a> TraitDef<'a> {
480480
ident: ident,
481481
vis: ast::Inherited,
482482
attrs: Vec::new(),
483-
node: ast::TypeImplItem(type_def.to_ty(cx,
483+
node: ast::ImplItemKind::Type(type_def.to_ty(cx,
484484
self.span,
485485
type_ident,
486486
generics
@@ -895,7 +895,7 @@ impl<'a> MethodDef<'a> {
895895
span: trait_.span,
896896
vis: ast::Inherited,
897897
ident: method_ident,
898-
node: ast::MethodImplItem(ast::MethodSig {
898+
node: ast::ImplItemKind::Method(ast::MethodSig {
899899
generics: fn_generics,
900900
abi: abi,
901901
explicit_self: explicit_self,

src/libsyntax/ext/expand.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1030,23 +1030,23 @@ fn expand_item_multi_modifier(mut it: Annotatable,
10301030
fn expand_impl_item(ii: P<ast::ImplItem>, fld: &mut MacroExpander)
10311031
-> SmallVector<P<ast::ImplItem>> {
10321032
match ii.node {
1033-
ast::MethodImplItem(..) => SmallVector::one(ii.map(|ii| ast::ImplItem {
1033+
ast::ImplItemKind::Method(..) => SmallVector::one(ii.map(|ii| ast::ImplItem {
10341034
id: ii.id,
10351035
ident: ii.ident,
10361036
attrs: ii.attrs,
10371037
vis: ii.vis,
10381038
node: match ii.node {
1039-
ast::MethodImplItem(sig, body) => {
1039+
ast::ImplItemKind::Method(sig, body) => {
10401040
let (sig, body) = expand_and_rename_method(sig, body, fld);
1041-
ast::MethodImplItem(sig, body)
1041+
ast::ImplItemKind::Method(sig, body)
10421042
}
10431043
_ => unreachable!()
10441044
},
10451045
span: fld.new_span(ii.span)
10461046
})),
1047-
ast::MacImplItem(_) => {
1047+
ast::ImplItemKind::Macro(_) => {
10481048
let (span, mac) = ii.and_then(|ii| match ii.node {
1049-
ast::MacImplItem(mac) => (ii.span, mac),
1049+
ast::ImplItemKind::Macro(mac) => (ii.span, mac),
10501050
_ => unreachable!()
10511051
});
10521052
let maybe_new_items =

src/libsyntax/feature_gate.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -998,12 +998,12 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
998998

999999
fn visit_impl_item(&mut self, ii: &'v ast::ImplItem) {
10001000
match ii.node {
1001-
ast::ConstImplItem(..) => {
1001+
ast::ImplItemKind::Const(..) => {
10021002
self.gate_feature("associated_consts",
10031003
ii.span,
10041004
"associated constants are experimental")
10051005
}
1006-
ast::MethodImplItem(ref sig, _) => {
1006+
ast::ImplItemKind::Method(ref sig, _) => {
10071007
if sig.constness == ast::Constness::Const {
10081008
self.gate_feature("const_fn", ii.span, "const fn is unstable");
10091009
}

src/libsyntax/fold.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1001,15 +1001,15 @@ pub fn noop_fold_impl_item<T: Folder>(i: P<ImplItem>, folder: &mut T)
10011001
attrs: fold_attrs(attrs, folder),
10021002
vis: vis,
10031003
node: match node {
1004-
ConstImplItem(ty, expr) => {
1005-
ConstImplItem(folder.fold_ty(ty), folder.fold_expr(expr))
1004+
ast::ImplItemKind::Const(ty, expr) => {
1005+
ast::ImplItemKind::Const(folder.fold_ty(ty), folder.fold_expr(expr))
10061006
}
1007-
MethodImplItem(sig, body) => {
1008-
MethodImplItem(noop_fold_method_sig(sig, folder),
1007+
ast::ImplItemKind::Method(sig, body) => {
1008+
ast::ImplItemKind::Method(noop_fold_method_sig(sig, folder),
10091009
folder.fold_block(body))
10101010
}
1011-
TypeImplItem(ty) => TypeImplItem(folder.fold_ty(ty)),
1012-
MacImplItem(mac) => MacImplItem(folder.fold_mac(mac))
1011+
ast::ImplItemKind::Type(ty) => ast::ImplItemKind::Type(folder.fold_ty(ty)),
1012+
ast::ImplItemKind::Macro(mac) => ast::ImplItemKind::Macro(folder.fold_mac(mac))
10131013
},
10141014
span: folder.new_span(span)
10151015
}))

src/libsyntax/parse/parser.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use ast::{Public, Unsafety};
1717
use ast::{Mod, BiAdd, Arg, Arm, Attribute, BindByRef, BindByValue};
1818
use ast::{BiBitAnd, BiBitOr, BiBitXor, BiRem, BiLt, Block};
1919
use ast::{BlockCheckMode, CaptureByRef, CaptureByValue, CaptureClause};
20-
use ast::{Constness, ConstImplItem, ConstTraitItem, Crate, CrateConfig};
20+
use ast::{Constness, ConstTraitItem, Crate, CrateConfig};
2121
use ast::{Decl, DeclItem, DeclLocal, DefaultBlock, DefaultReturn};
2222
use ast::{UnDeref, BiDiv, EMPTY_CTXT, EnumDef, ExplicitSelf};
2323
use ast::{Expr, Expr_, ExprAddrOf, ExprMatch, ExprAgain};
@@ -39,7 +39,7 @@ use ast::{LitStr, LitInt, Local};
3939
use ast::{MacStmtWithBraces, MacStmtWithSemicolon, MacStmtWithoutBraces};
4040
use ast::{MutImmutable, MutMutable, Mac_};
4141
use ast::{MutTy, BiMul, Mutability};
42-
use ast::{MethodImplItem, NamedField, UnNeg, NoReturn, UnNot};
42+
use ast::{NamedField, UnNeg, NoReturn, UnNot};
4343
use ast::{Pat, PatBox, PatEnum, PatIdent, PatLit, PatQPath, PatMac, PatRange};
4444
use ast::{PatRegion, PatStruct, PatTup, PatVec, PatWild};
4545
use ast::{PolyTraitRef, QSelf};
@@ -52,7 +52,7 @@ use ast::{Ty, Ty_, TypeBinding, TyMac};
5252
use ast::{TyFixedLengthVec, TyBareFn, TyTypeof, TyInfer};
5353
use ast::{TyParam, TyParamBound, TyParen, TyPath, TyPolyTraitRef, TyPtr};
5454
use ast::{TyRptr, TyTup, TyU32, TyVec};
55-
use ast::{TypeImplItem, TypeTraitItem};
55+
use ast::TypeTraitItem;
5656
use ast::{UnnamedField, UnsafeBlock};
5757
use ast::{ViewPath, ViewPathGlob, ViewPathList, ViewPathSimple};
5858
use ast::{Visibility, WhereClause};
@@ -4425,7 +4425,7 @@ impl<'a> Parser<'a> {
44254425
try!(self.expect(&token::Eq));
44264426
let typ = try!(self.parse_ty_sum());
44274427
try!(self.expect(&token::Semi));
4428-
(name, TypeImplItem(typ))
4428+
(name, ast::ImplItemKind::Type(typ))
44294429
} else if self.is_const_item() {
44304430
try!(self.expect_keyword(keywords::Const));
44314431
let name = try!(self.parse_ident());
@@ -4434,7 +4434,7 @@ impl<'a> Parser<'a> {
44344434
try!(self.expect(&token::Eq));
44354435
let expr = try!(self.parse_expr());
44364436
try!(self.commit_expr_expecting(&expr, token::Semi));
4437-
(name, ConstImplItem(typ, expr))
4437+
(name, ast::ImplItemKind::Const(typ, expr))
44384438
} else {
44394439
let (name, inner_attrs, node) = try!(self.parse_impl_method(vis));
44404440
attrs.extend(inner_attrs);
@@ -4464,7 +4464,7 @@ impl<'a> Parser<'a> {
44644464

44654465
/// Parse a method or a macro invocation in a trait impl.
44664466
fn parse_impl_method(&mut self, vis: Visibility)
4467-
-> PResult<(Ident, Vec<ast::Attribute>, ast::ImplItem_)> {
4467+
-> PResult<(Ident, Vec<ast::Attribute>, ast::ImplItemKind)> {
44684468
// code copied from parse_macro_use_or_failure... abstraction!
44694469
if !self.token.is_any_keyword()
44704470
&& self.look_ahead(1, |t| *t == token::Not)
@@ -4490,7 +4490,7 @@ impl<'a> Parser<'a> {
44904490
if delim != token::Brace {
44914491
try!(self.expect(&token::Semi))
44924492
}
4493-
Ok((token::special_idents::invalid, vec![], ast::MacImplItem(m)))
4493+
Ok((token::special_idents::invalid, vec![], ast::ImplItemKind::Macro(m)))
44944494
} else {
44954495
let (constness, unsafety, abi) = try!(self.parse_fn_front_matter());
44964496
let ident = try!(self.parse_ident());
@@ -4500,7 +4500,7 @@ impl<'a> Parser<'a> {
45004500
}));
45014501
generics.where_clause = try!(self.parse_where_clause());
45024502
let (inner_attrs, body) = try!(self.parse_inner_attrs_and_block());
4503-
Ok((ident, inner_attrs, MethodImplItem(ast::MethodSig {
4503+
Ok((ident, inner_attrs, ast::ImplItemKind::Method(ast::MethodSig {
45044504
generics: generics,
45054505
abi: abi,
45064506
explicit_self: explicit_self,

src/libsyntax/print/pprust.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1576,19 +1576,19 @@ impl<'a> State<'a> {
15761576
try!(self.maybe_print_comment(ii.span.lo));
15771577
try!(self.print_outer_attributes(&ii.attrs));
15781578
match ii.node {
1579-
ast::ConstImplItem(ref ty, ref expr) => {
1579+
ast::ImplItemKind::Const(ref ty, ref expr) => {
15801580
try!(self.print_associated_const(ii.ident, &ty, Some(&expr), ii.vis));
15811581
}
1582-
ast::MethodImplItem(ref sig, ref body) => {
1582+
ast::ImplItemKind::Method(ref sig, ref body) => {
15831583
try!(self.head(""));
15841584
try!(self.print_method_sig(ii.ident, sig, ii.vis));
15851585
try!(self.nbsp());
15861586
try!(self.print_block_with_attrs(body, &ii.attrs));
15871587
}
1588-
ast::TypeImplItem(ref ty) => {
1588+
ast::ImplItemKind::Type(ref ty) => {
15891589
try!(self.print_associated_type(ii.ident, None, Some(ty)));
15901590
}
1591-
ast::MacImplItem(codemap::Spanned { ref node, .. }) => {
1591+
ast::ImplItemKind::Macro(codemap::Spanned { ref node, .. }) => {
15921592
// code copied from ItemMac:
15931593
try!(self.print_path(&node.path, false, 0));
15941594
try!(word(&mut self.s, "! "));

src/libsyntax/visit.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -588,18 +588,18 @@ pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplIt
588588
visitor.visit_ident(impl_item.span, impl_item.ident);
589589
walk_list!(visitor, visit_attribute, &impl_item.attrs);
590590
match impl_item.node {
591-
ConstImplItem(ref ty, ref expr) => {
591+
ImplItemKind::Const(ref ty, ref expr) => {
592592
visitor.visit_ty(ty);
593593
visitor.visit_expr(expr);
594594
}
595-
MethodImplItem(ref sig, ref body) => {
595+
ImplItemKind::Method(ref sig, ref body) => {
596596
visitor.visit_fn(FnKind::Method(impl_item.ident, sig, Some(impl_item.vis)), &sig.decl,
597597
body, impl_item.span, impl_item.id);
598598
}
599-
TypeImplItem(ref ty) => {
599+
ImplItemKind::Type(ref ty) => {
600600
visitor.visit_ty(ty);
601601
}
602-
MacImplItem(ref mac) => {
602+
ImplItemKind::Macro(ref mac) => {
603603
visitor.visit_mac(mac);
604604
}
605605
}

0 commit comments

Comments
 (0)