rename ImplItem_::*ImplItem to ImplItem_::*

[breaking change]
This commit is contained in:
Oliver Schneider 2015-11-11 10:37:25 +01:00
parent af5d9d65e7
commit eaaa60dbea
31 changed files with 103 additions and 106 deletions

View file

@ -236,7 +236,7 @@ impl<'a> FnLikeNode<'a> {
},
map::NodeImplItem(ii) => {
match ii.node {
ast::MethodImplItem(ref sig, ref body) => {
ast::ImplItem_::Method(ref sig, ref body) => {
method(ii.id, ii.name, sig, Some(ii.vis), body, ii.span)
}
_ => {

View file

@ -224,8 +224,8 @@ impl<'ast> Visitor<'ast> for NodeCollector<'ast> {
fn visit_impl_item(&mut self, ii: &'ast ImplItem) {
let def_data = match ii.node {
MethodImplItem(..) | ConstImplItem(..) => DefPathData::Value(ii.name),
TypeImplItem(..) => DefPathData::Type(ii.name),
ImplItem_::Method(..) | ImplItem_::Const(..) => DefPathData::Value(ii.name),
ImplItem_::Type(..) => DefPathData::Type(ii.name),
};
self.insert_def(ii.id, NodeImplItem(ii), def_data);
@ -234,7 +234,7 @@ impl<'ast> Visitor<'ast> for NodeCollector<'ast> {
self.parent_node = ii.id;
match ii.node {
ConstImplItem(_, ref expr) => {
ImplItem_::Const(_, ref expr) => {
self.create_def(expr.id, DefPathData::Initializer);
}
_ => { }
@ -313,4 +313,3 @@ impl<'ast> Visitor<'ast> for NodeCollector<'ast> {
self.create_def(macro_def.id, DefPathData::MacroDef(macro_def.name));
}
}

View file

@ -937,18 +937,18 @@ fn node_id_to_string(map: &Map, id: NodeId, include_id: bool) -> String {
}
Some(NodeImplItem(ii)) => {
match ii.node {
ConstImplItem(..) => {
ImplItem_::Const(..) => {
format!("assoc const {} in {}{}",
ii.name,
map.path_to_string(id),
id_str)
}
MethodImplItem(..) => {
ImplItem_::Method(..) => {
format!("method {} in {}{}",
ii.name,
map.path_to_string(id), id_str)
}
TypeImplItem(_) => {
ImplItem_::Type(_) => {
format!("assoc type {} in {}{}",
ii.name,
map.path_to_string(id),

View file

@ -739,7 +739,7 @@ fn encode_info_for_method<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
let elem = ast_map::PathName(m.name);
encode_path(rbml_w, impl_path.chain(Some(elem)));
if let Some(impl_item) = impl_item_opt {
if let hir::MethodImplItem(ref sig, _) = impl_item.node {
if let hir::ImplItem_::Method(ref sig, _) = impl_item.node {
encode_attributes(rbml_w, &impl_item.attrs);
let scheme = ecx.tcx.lookup_item_type(m.def_id);
let any_types = !scheme.generics.types.is_empty();

View file

@ -348,7 +348,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for CheckCrateVisitor<'a, 'tcx> {
fn visit_impl_item(&mut self, i: &'v hir::ImplItem) {
match i.node {
hir::ConstImplItem(_, ref expr) => {
hir::ImplItem_::Const(_, ref expr) => {
self.global_expr(Mode::Const, &*expr);
}
_ => self.with_mode(Mode::Var, |v| visit::walk_impl_item(v, i)),

View file

@ -79,7 +79,7 @@ impl<'a, 'ast: 'a> Visitor<'ast> for CheckCrateVisitor<'a, 'ast> {
fn visit_impl_item(&mut self, ii: &'ast hir::ImplItem) {
match ii.node {
hir::ConstImplItem(..) => {
hir::ImplItem_::Const(..) => {
let mut recursion_visitor =
CheckItemRecursionVisitor::new(self, &ii.span);
recursion_visitor.visit_impl_item(ii);

View file

@ -129,7 +129,7 @@ pub fn lookup_const_by_id<'a, 'tcx: 'a>(tcx: &'a ty::ctxt<'tcx>,
_ => None
},
Some(ast_map::NodeImplItem(ii)) => match ii.node {
hir::ConstImplItem(_, ref expr) => {
hir::ImplItem_::Const(_, ref expr) => {
Some(&*expr)
}
_ => None
@ -171,7 +171,7 @@ pub fn lookup_const_by_id<'a, 'tcx: 'a>(tcx: &'a ty::ctxt<'tcx>,
_ => None
},
csearch::FoundAst::Found(&InlinedItem::ImplItem(_, ref ii)) => match ii.node {
hir::ConstImplItem(_, ref expr) => Some(expr.id),
hir::ImplItem_::Const(_, ref expr) => Some(expr.id),
_ => None
},
_ => None
@ -996,7 +996,7 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
},
ty::ImplContainer(_) => match tcx.map.find(node_id) {
Some(ast_map::NodeImplItem(ii)) => match ii.node {
hir::ConstImplItem(ref ty, ref expr) => {
hir::ImplItem_::Const(ref ty, ref expr) => {
(Some(&**expr), Some(&**ty))
}
_ => (None, None)

View file

@ -358,14 +358,14 @@ impl<'v> Visitor<'v> for LifeSeeder {
hir::ItemImpl(_, _, _, ref opt_trait, _, ref impl_items) => {
for impl_item in impl_items {
match impl_item.node {
hir::ConstImplItem(..) |
hir::MethodImplItem(..) => {
hir::ImplItem_::Const(..) |
hir::ImplItem_::Method(..) => {
if opt_trait.is_some() ||
has_allow_dead_code_or_lang_attr(&impl_item.attrs) {
self.worklist.push(impl_item.id);
}
}
hir::TypeImplItem(_) => {}
hir::ImplItem_::Type(_) => {}
}
}
}
@ -571,21 +571,21 @@ impl<'a, 'tcx, 'v> Visitor<'v> for DeadVisitor<'a, 'tcx> {
fn visit_impl_item(&mut self, impl_item: &hir::ImplItem) {
match impl_item.node {
hir::ConstImplItem(_, ref expr) => {
hir::ImplItem_::Const(_, ref expr) => {
if !self.symbol_is_live(impl_item.id, None) {
self.warn_dead_code(impl_item.id, impl_item.span,
impl_item.name, "associated const");
}
visit::walk_expr(self, expr)
}
hir::MethodImplItem(_, ref body) => {
hir::ImplItem_::Method(_, ref body) => {
if !self.symbol_is_live(impl_item.id, None) {
self.warn_dead_code(impl_item.id, impl_item.span,
impl_item.name, "method");
}
visit::walk_block(self, body)
}
hir::TypeImplItem(..) => {}
hir::ImplItem_::Type(..) => {}
}
}

View file

@ -948,7 +948,7 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
}
ast_map::NodeImplItem(item) => {
match item.node {
hir::MethodImplItem(ref sig, _) => {
hir::ImplItem_::Method(ref sig, _) => {
Some((&sig.decl,
&sig.generics,
sig.unsafety,
@ -1839,7 +1839,7 @@ fn lifetimes_in_scope(tcx: &ty::ctxt,
},
ast_map::NodeImplItem(ii) => {
match ii.node {
hir::MethodImplItem(ref sig, _) => {
hir::ImplItem_::Method(ref sig, _) => {
taken.push_all(&sig.generics.lifetimes);
Some(ii.id)
}

View file

@ -185,8 +185,8 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
}
Some(ast_map::NodeImplItem(impl_item)) => {
match impl_item.node {
hir::ConstImplItem(..) => true,
hir::MethodImplItem(ref sig, _) => {
hir::ImplItem_::Const(..) => true,
hir::ImplItem_::Method(ref sig, _) => {
if generics_require_inlining(&sig.generics) ||
attr::requests_inline(&impl_item.attrs) {
true
@ -206,7 +206,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
}
}
}
hir::TypeImplItem(_) => false,
hir::ImplItem_::Type(_) => false,
}
}
Some(_) => false,
@ -299,16 +299,16 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
}
ast_map::NodeImplItem(impl_item) => {
match impl_item.node {
hir::ConstImplItem(_, ref expr) => {
hir::ImplItem_::Const(_, ref expr) => {
self.visit_expr(&*expr);
}
hir::MethodImplItem(ref sig, ref body) => {
hir::ImplItem_::Method(ref sig, ref body) => {
let did = self.tcx.map.get_parent_did(search_item);
if method_might_be_inlined(self.tcx, sig, impl_item, did) {
visit::walk_block(self, body)
}
}
hir::TypeImplItem(_) => {}
hir::ImplItem_::Type(_) => {}
}
}
// Nothing to recurse on for these

View file

@ -1124,7 +1124,7 @@ impl<'a, 'tcx> ParameterEnvironment<'a, 'tcx> {
match cx.map.find(id) {
Some(ast_map::NodeImplItem(ref impl_item)) => {
match impl_item.node {
hir::TypeImplItem(_) => {
hir::ImplItem_::Type(_) => {
// associated types don't have their own entry (for some reason),
// so for now just grab environment for the impl
let impl_id = cx.map.get_parent(id);
@ -1136,7 +1136,7 @@ impl<'a, 'tcx> ParameterEnvironment<'a, 'tcx> {
&predicates,
id)
}
hir::ConstImplItem(_, _) => {
hir::ImplItem_::Const(_, _) => {
let def_id = cx.map.local_def_id(id);
let scheme = cx.lookup_item_type(def_id);
let predicates = cx.lookup_predicates(def_id);
@ -1145,7 +1145,7 @@ impl<'a, 'tcx> ParameterEnvironment<'a, 'tcx> {
&predicates,
id)
}
hir::MethodImplItem(_, ref body) => {
hir::ImplItem_::Method(_, ref body) => {
let method_def_id = cx.map.local_def_id(id);
match cx.impl_or_trait_item(method_def_id) {
MethodTraitItem(ref method_ty) => {
@ -2158,7 +2158,7 @@ impl<'tcx> ctxt<'tcx> {
}
ItemImpl(_, _, _, _, _, ref iis) => {
iis.iter().filter_map(|ii| {
if let hir::ConstImplItem(_, _) = ii.node {
if let hir::ImplItem_::Const(_, _) = ii.node {
match self.impl_or_trait_item(self.map.local_def_id(ii.id)) {
ConstTraitItem(ac) => Some(ac),
_ => {