Skip to content

Commit 4e2189f

Browse files
committed
Remove NodeArg
1 parent d7944ce commit 4e2189f

File tree

5 files changed

+3
-30
lines changed

5 files changed

+3
-30
lines changed

src/librustc/front/map/collector.rs

-17
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,6 @@ impl<'ast> NodeCollector<'ast> {
104104
let entry = MapEntry::from_node(self.parent_node, node);
105105
self.insert_entry(id, entry);
106106
}
107-
108-
fn visit_fn_decl(&mut self, decl: &'ast FnDecl) {
109-
for a in &decl.inputs {
110-
self.insert(a.id, NodeArg(&*a.pat));
111-
}
112-
}
113107
}
114108

115109
impl<'ast> Visitor<'ast> for NodeCollector<'ast> {
@@ -295,20 +289,9 @@ impl<'ast> Visitor<'ast> for NodeCollector<'ast> {
295289
fn visit_fn(&mut self, fk: visit::FnKind<'ast>, fd: &'ast FnDecl,
296290
b: &'ast Block, s: Span, id: NodeId) {
297291
assert_eq!(self.parent_node, id);
298-
self.visit_fn_decl(fd);
299292
visit::walk_fn(self, fk, fd, b, s);
300293
}
301294

302-
fn visit_ty(&mut self, ty: &'ast Ty) {
303-
match ty.node {
304-
TyBareFn(ref fd) => {
305-
self.visit_fn_decl(&*fd.decl);
306-
}
307-
_ => {}
308-
}
309-
visit::walk_ty(self, ty);
310-
}
311-
312295
fn visit_block(&mut self, block: &'ast Block) {
313296
self.insert(block.id, NodeBlock(block));
314297
let parent_node = self.parent_node;

src/librustc/front/map/mod.rs

+1-10
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ pub enum Node<'ast> {
118118
NodeVariant(&'ast Variant),
119119
NodeExpr(&'ast Expr),
120120
NodeStmt(&'ast Stmt),
121-
NodeArg(&'ast Pat),
122121
NodeLocal(&'ast Pat),
123122
NodePat(&'ast Pat),
124123
NodeBlock(&'ast Block),
@@ -145,7 +144,6 @@ pub enum MapEntry<'ast> {
145144
EntryVariant(NodeId, &'ast Variant),
146145
EntryExpr(NodeId, &'ast Expr),
147146
EntryStmt(NodeId, &'ast Stmt),
148-
EntryArg(NodeId, &'ast Pat),
149147
EntryLocal(NodeId, &'ast Pat),
150148
EntryPat(NodeId, &'ast Pat),
151149
EntryBlock(NodeId, &'ast Block),
@@ -180,7 +178,6 @@ impl<'ast> MapEntry<'ast> {
180178
NodeVariant(n) => EntryVariant(p, n),
181179
NodeExpr(n) => EntryExpr(p, n),
182180
NodeStmt(n) => EntryStmt(p, n),
183-
NodeArg(n) => EntryArg(p, n),
184181
NodeLocal(n) => EntryLocal(p, n),
185182
NodePat(n) => EntryPat(p, n),
186183
NodeBlock(n) => EntryBlock(p, n),
@@ -199,7 +196,6 @@ impl<'ast> MapEntry<'ast> {
199196
EntryVariant(id, _) => id,
200197
EntryExpr(id, _) => id,
201198
EntryStmt(id, _) => id,
202-
EntryArg(id, _) => id,
203199
EntryLocal(id, _) => id,
204200
EntryPat(id, _) => id,
205201
EntryBlock(id, _) => id,
@@ -219,7 +215,6 @@ impl<'ast> MapEntry<'ast> {
219215
EntryVariant(_, n) => NodeVariant(n),
220216
EntryExpr(_, n) => NodeExpr(n),
221217
EntryStmt(_, n) => NodeStmt(n),
222-
EntryArg(_, n) => NodeArg(n),
223218
EntryLocal(_, n) => NodeLocal(n),
224219
EntryPat(_, n) => NodePat(n),
225220
EntryBlock(_, n) => NodeBlock(n),
@@ -649,7 +644,7 @@ impl<'ast> Map<'ast> {
649644
Some(NodeVariant(variant)) => variant.span,
650645
Some(NodeExpr(expr)) => expr.span,
651646
Some(NodeStmt(stmt)) => stmt.span,
652-
Some(NodeArg(pat)) | Some(NodeLocal(pat)) => pat.span,
647+
Some(NodeLocal(pat)) => pat.span,
653648
Some(NodePat(pat)) => pat.span,
654649
Some(NodeBlock(block)) => block.span,
655650
Some(NodeStructCtor(_)) => self.expect_item(self.get_parent(id)).span,
@@ -907,7 +902,6 @@ impl<'a> NodePrinter for pprust::State<'a> {
907902
// ast_map to reconstruct their full structure for pretty
908903
// printing.
909904
NodeLocal(_) => panic!("cannot print isolated Local"),
910-
NodeArg(_) => panic!("cannot print isolated Arg"),
911905
NodeStructCtor(_) => panic!("cannot print isolated StructCtor"),
912906
}
913907
}
@@ -986,9 +980,6 @@ fn node_id_to_string(map: &Map, id: NodeId, include_id: bool) -> String {
986980
Some(NodeStmt(ref stmt)) => {
987981
format!("stmt {}{}", pprust::stmt_to_string(&**stmt), id_str)
988982
}
989-
Some(NodeArg(ref pat)) => {
990-
format!("arg {}{}", pprust::pat_to_string(&**pat), id_str)
991-
}
992983
Some(NodeLocal(ref pat)) => {
993984
format!("local {}{}", pprust::pat_to_string(&**pat), id_str)
994985
}

src/librustc/middle/mem_categorization.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ impl MutabilityCategory {
305305

306306
fn from_local(tcx: &ty::ctxt, id: ast::NodeId) -> MutabilityCategory {
307307
let ret = match tcx.map.get(id) {
308-
ast_map::NodeLocal(p) | ast_map::NodeArg(p) => match p.node {
308+
ast_map::NodeLocal(p) => match p.node {
309309
hir::PatIdent(bind_mode, _, _) => {
310310
if bind_mode == hir::BindByValue(hir::MutMutable) {
311311
McDeclared

src/librustc_trans/trans/debuginfo/metadata.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1976,7 +1976,7 @@ pub fn create_captured_var_metadata<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
19761976
None => {
19771977
cx.sess().span_bug(span, "debuginfo::create_captured_var_metadata: node not found");
19781978
}
1979-
Some(hir_map::NodeLocal(pat)) | Some(hir_map::NodeArg(pat)) => {
1979+
Some(hir_map::NodeLocal(pat)) => {
19801980
match pat.node {
19811981
hir::PatIdent(_, ref path1, _) => {
19821982
path1.node.name

src/librustc_trans/trans/monomorphize.rs

-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@ pub fn monomorphic_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
262262
hir_map::NodeTyParam(..) |
263263
hir_map::NodeExpr(..) |
264264
hir_map::NodeStmt(..) |
265-
hir_map::NodeArg(..) |
266265
hir_map::NodeBlock(..) |
267266
hir_map::NodePat(..) |
268267
hir_map::NodeLocal(..) => {

0 commit comments

Comments
 (0)