Skip to content

Commit b31cc64

Browse files
committed
Auto merge of #29766 - oli-obk:impl_item, r=nikomatsakis
[breaking change] I'm not sure if those renames are ok. [TokenType::Tt* to TokenType::*](#29582) was obvious, but for all those Item-enums it's less obvious to me what the right way forward is due to the underscore.
2 parents 8809a33 + d09220d commit b31cc64

File tree

41 files changed

+150
-154
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+150
-154
lines changed

src/librustc/front/map/blocks.rs

Lines changed: 1 addition & 1 deletion
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::MethodImplItem(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/front/map/collector.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ impl<'ast> Visitor<'ast> for NodeCollector<'ast> {
224224

225225
fn visit_impl_item(&mut self, ii: &'ast ImplItem) {
226226
let def_data = match ii.node {
227-
MethodImplItem(..) | ConstImplItem(..) => DefPathData::Value(ii.name),
228-
TypeImplItem(..) => DefPathData::Type(ii.name),
227+
ImplItemKind::Method(..) | ImplItemKind::Const(..) => DefPathData::Value(ii.name),
228+
ImplItemKind::Type(..) => DefPathData::Type(ii.name),
229229
};
230230

231231
self.insert_def(ii.id, NodeImplItem(ii), def_data);
@@ -234,7 +234,7 @@ impl<'ast> Visitor<'ast> for NodeCollector<'ast> {
234234
self.parent_node = ii.id;
235235

236236
match ii.node {
237-
ConstImplItem(_, ref expr) => {
237+
ImplItemKind::Const(_, ref expr) => {
238238
self.create_def(expr.id, DefPathData::Initializer);
239239
}
240240
_ => { }
@@ -313,4 +313,3 @@ impl<'ast> Visitor<'ast> for NodeCollector<'ast> {
313313
self.create_def(macro_def.id, DefPathData::MacroDef(macro_def.name));
314314
}
315315
}
316-

src/librustc/front/map/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -937,18 +937,18 @@ fn node_id_to_string(map: &Map, id: NodeId, include_id: bool) -> String {
937937
}
938938
Some(NodeImplItem(ii)) => {
939939
match ii.node {
940-
ConstImplItem(..) => {
940+
ImplItemKind::Const(..) => {
941941
format!("assoc const {} in {}{}",
942942
ii.name,
943943
map.path_to_string(id),
944944
id_str)
945945
}
946-
MethodImplItem(..) => {
946+
ImplItemKind::Method(..) => {
947947
format!("method {} in {}{}",
948948
ii.name,
949949
map.path_to_string(id), id_str)
950950
}
951-
TypeImplItem(_) => {
951+
ImplItemKind::Type(_) => {
952952
format!("assoc type {} in {}{}",
953953
ii.name,
954954
map.path_to_string(id),

src/librustc/metadata/encoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ fn encode_info_for_method<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
739739
let elem = ast_map::PathName(m.name);
740740
encode_path(rbml_w, impl_path.chain(Some(elem)));
741741
if let Some(impl_item) = impl_item_opt {
742-
if let hir::MethodImplItem(ref sig, _) = impl_item.node {
742+
if let hir::ImplItemKind::Method(ref sig, _) = impl_item.node {
743743
encode_attributes(rbml_w, &impl_item.attrs);
744744
let scheme = ecx.tcx.lookup_item_type(m.def_id);
745745
let any_types = !scheme.generics.types.is_empty();

src/librustc/middle/check_const.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for CheckCrateVisitor<'a, 'tcx> {
348348

349349
fn visit_impl_item(&mut self, i: &'v hir::ImplItem) {
350350
match i.node {
351-
hir::ConstImplItem(_, ref expr) => {
351+
hir::ImplItemKind::Const(_, ref expr) => {
352352
self.global_expr(Mode::Const, &*expr);
353353
}
354354
_ => self.with_mode(Mode::Var, |v| visit::walk_impl_item(v, i)),

src/librustc/middle/check_static_recursion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl<'a, 'ast: 'a> Visitor<'ast> for CheckCrateVisitor<'a, 'ast> {
7979

8080
fn visit_impl_item(&mut self, ii: &'ast hir::ImplItem) {
8181
match ii.node {
82-
hir::ConstImplItem(..) => {
82+
hir::ImplItemKind::Const(..) => {
8383
let mut recursion_visitor =
8484
CheckItemRecursionVisitor::new(self, &ii.span);
8585
recursion_visitor.visit_impl_item(ii);

src/librustc/middle/const_eval.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ pub fn lookup_const_by_id<'a, 'tcx: 'a>(tcx: &'a ty::ctxt<'tcx>,
129129
_ => None
130130
},
131131
Some(ast_map::NodeImplItem(ii)) => match ii.node {
132-
hir::ConstImplItem(_, ref expr) => {
132+
hir::ImplItemKind::Const(_, ref expr) => {
133133
Some(&*expr)
134134
}
135135
_ => None
@@ -171,7 +171,7 @@ pub fn lookup_const_by_id<'a, 'tcx: 'a>(tcx: &'a ty::ctxt<'tcx>,
171171
_ => None
172172
},
173173
csearch::FoundAst::Found(&InlinedItem::ImplItem(_, ref ii)) => match ii.node {
174-
hir::ConstImplItem(_, ref expr) => Some(expr.id),
174+
hir::ImplItemKind::Const(_, ref expr) => Some(expr.id),
175175
_ => None
176176
},
177177
_ => None
@@ -996,7 +996,7 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
996996
},
997997
ty::ImplContainer(_) => match tcx.map.find(node_id) {
998998
Some(ast_map::NodeImplItem(ii)) => match ii.node {
999-
hir::ConstImplItem(ref ty, ref expr) => {
999+
hir::ImplItemKind::Const(ref ty, ref expr) => {
10001000
(Some(&**expr), Some(&**ty))
10011001
}
10021002
_ => (None, None)

src/librustc/middle/dead.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -358,14 +358,14 @@ impl<'v> Visitor<'v> for LifeSeeder {
358358
hir::ItemImpl(_, _, _, ref opt_trait, _, ref impl_items) => {
359359
for impl_item in impl_items {
360360
match impl_item.node {
361-
hir::ConstImplItem(..) |
362-
hir::MethodImplItem(..) => {
361+
hir::ImplItemKind::Const(..) |
362+
hir::ImplItemKind::Method(..) => {
363363
if opt_trait.is_some() ||
364364
has_allow_dead_code_or_lang_attr(&impl_item.attrs) {
365365
self.worklist.push(impl_item.id);
366366
}
367367
}
368-
hir::TypeImplItem(_) => {}
368+
hir::ImplItemKind::Type(_) => {}
369369
}
370370
}
371371
}
@@ -571,21 +571,21 @@ impl<'a, 'tcx, 'v> Visitor<'v> for DeadVisitor<'a, 'tcx> {
571571

572572
fn visit_impl_item(&mut self, impl_item: &hir::ImplItem) {
573573
match impl_item.node {
574-
hir::ConstImplItem(_, ref expr) => {
574+
hir::ImplItemKind::Const(_, ref expr) => {
575575
if !self.symbol_is_live(impl_item.id, None) {
576576
self.warn_dead_code(impl_item.id, impl_item.span,
577577
impl_item.name, "associated const");
578578
}
579579
visit::walk_expr(self, expr)
580580
}
581-
hir::MethodImplItem(_, ref body) => {
581+
hir::ImplItemKind::Method(_, ref body) => {
582582
if !self.symbol_is_live(impl_item.id, None) {
583583
self.warn_dead_code(impl_item.id, impl_item.span,
584584
impl_item.name, "method");
585585
}
586586
visit::walk_block(self, body)
587587
}
588-
hir::TypeImplItem(..) => {}
588+
hir::ImplItemKind::Type(..) => {}
589589
}
590590
}
591591

src/librustc/middle/infer/error_reporting.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
948948
}
949949
ast_map::NodeImplItem(item) => {
950950
match item.node {
951-
hir::MethodImplItem(ref sig, _) => {
951+
hir::ImplItemKind::Method(ref sig, _) => {
952952
Some((&sig.decl,
953953
&sig.generics,
954954
sig.unsafety,
@@ -1838,7 +1838,7 @@ fn lifetimes_in_scope(tcx: &ty::ctxt,
18381838
},
18391839
ast_map::NodeImplItem(ii) => {
18401840
match ii.node {
1841-
hir::MethodImplItem(ref sig, _) => {
1841+
hir::ImplItemKind::Method(ref sig, _) => {
18421842
taken.push_all(&sig.generics.lifetimes);
18431843
Some(ii.id)
18441844
}

src/librustc/middle/reachable.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
185185
}
186186
Some(ast_map::NodeImplItem(impl_item)) => {
187187
match impl_item.node {
188-
hir::ConstImplItem(..) => true,
189-
hir::MethodImplItem(ref sig, _) => {
188+
hir::ImplItemKind::Const(..) => true,
189+
hir::ImplItemKind::Method(ref sig, _) => {
190190
if generics_require_inlining(&sig.generics) ||
191191
attr::requests_inline(&impl_item.attrs) {
192192
true
@@ -206,7 +206,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
206206
}
207207
}
208208
}
209-
hir::TypeImplItem(_) => false,
209+
hir::ImplItemKind::Type(_) => false,
210210
}
211211
}
212212
Some(_) => false,
@@ -299,16 +299,16 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
299299
}
300300
ast_map::NodeImplItem(impl_item) => {
301301
match impl_item.node {
302-
hir::ConstImplItem(_, ref expr) => {
302+
hir::ImplItemKind::Const(_, ref expr) => {
303303
self.visit_expr(&*expr);
304304
}
305-
hir::MethodImplItem(ref sig, ref body) => {
305+
hir::ImplItemKind::Method(ref sig, ref body) => {
306306
let did = self.tcx.map.get_parent_did(search_item);
307307
if method_might_be_inlined(self.tcx, sig, impl_item, did) {
308308
visit::walk_block(self, body)
309309
}
310310
}
311-
hir::TypeImplItem(_) => {}
311+
hir::ImplItemKind::Type(_) => {}
312312
}
313313
}
314314
// Nothing to recurse on for these

0 commit comments

Comments
 (0)