Skip to content

Commit 093faaa

Browse files
committed
Handle index expressions' callee IDs correctly
Some code that handles unary and binary exprs' callee IDs was forgetting to handle the index expr case (since calls to user-defined index operators also have callee IDs). This was manifesting as an ICE in trans because when monomorphizing a function that had one of these operators in it (an index into a dvec, in the test case), the callee ID would be unbound to a type. Fixed it. Closes #2631.
1 parent 7a253ea commit 093faaa

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/libsyntax/ast_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> {
455455
visit_expr: fn@(e: @expr) {
456456
vfn(e.id);
457457
alt e.node {
458-
expr_unary(_, _) | expr_binary(_, _, _) {
458+
expr_unary(*) | expr_binary(*) | expr_index(*) {
459459
vfn(ast_util::op_expr_callee_id(e));
460460
}
461461
_ { /* fallthrough */ }

src/rustc/middle/astencode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ fn visit_ids(item: ast::inlined_item, vfn: fn@(ast::node_id)) {
200200
visit_expr: fn@(e: @ast::expr) {
201201
vfn(e.id);
202202
alt e.node {
203-
ast::expr_unary(_, _) | ast::expr_binary(_, _, _) {
203+
ast::expr_unary(*) | ast::expr_binary(*) | ast::expr_index(*) {
204204
vfn(ast_util::op_expr_callee_id(e));
205205
}
206206
_ { /* fallthrough */ }

src/rustc/middle/borrowck/check_loans.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ fn check_loans_in_expr(expr: @ast::expr,
583583
expr.span,
584584
[rval]);
585585
}
586-
ast::expr_unary(_, _)
586+
ast::expr_unary(*) | ast::expr_index(*)
587587
if self.bccx.method_map.contains_key(expr.id) {
588588
self.check_call(expr,
589589
none,

src/rustc/middle/typeck/check/writeback.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ fn visit_expr(e: @ast::expr, wbcx: wb_ctxt, v: wb_vt) {
103103
resolve_type_vars_for_node(wbcx, e.span, alloc_id);
104104
}
105105

106-
ast::expr_binary(_, _, _) | ast::expr_unary(_, _) |
107-
ast::expr_assign_op(_, _, _) | ast::expr_index(_, _) {
106+
ast::expr_binary(*) | ast::expr_unary(*) | ast::expr_assign_op(*)
107+
| ast::expr_index(*) {
108108
maybe_resolve_type_vars_for_node(wbcx, e.span,
109109
ast_util::op_expr_callee_id(e));
110110
}

0 commit comments

Comments
 (0)