Skip to content

Commit 6a74253

Browse files
committed
Don't warn about unused for-loop index variables
1 parent d8db9a0 commit 6a74253

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/comp/middle/tstate/pre_post_conditions.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@ fn find_pre_post_loop(&fn_ctxt fcx, &@local l, &@expr index, &block body,
176176
find_pre_post_block(fcx, body);
177177
auto v_init = rec(id=l.node.id, c=ninit(l.node.ident));
178178
relax_precond_block(fcx, bit_num(fcx, v_init) as node_id, body);
179+
180+
// Hack: for-loop index variables are frequently ignored,
181+
// so we pretend they're used
182+
use_var(fcx, l.node.id);
179183

180184
auto loop_precond =
181185
seq_preconds(fcx,

0 commit comments

Comments
 (0)