Skip to content

Commit a3dfaa6

Browse files
committed
rollup merge of rust-lang#20027: michaelwoerister/for-loop-var
Back when for-loop iteration variables were just de-sugared into `let` bindings, debuginfo for them was created like for any other `let` binding. When the implementation approach for for-loops changed, we ceased having debuginfo for the iteration variable. This PR fixes this omission and adds a more prominent test case for it. Also contains some minor, general cleanup of the debuginfo module. Fixes rust-lang#19732
2 parents de7abcf + 87c5927 commit a3dfaa6

File tree

4 files changed

+302
-71
lines changed

4 files changed

+302
-71
lines changed

src/librustc_trans/trans/controlflow.rs

+3
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ pub fn trans_for<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
286286
debug!("iterator type is {}, datum type is {}",
287287
ppaux::ty_to_string(bcx.tcx(), iterator_type),
288288
ppaux::ty_to_string(bcx.tcx(), iterator_datum.ty));
289+
289290
let lliterator = load_ty(bcx, iterator_datum.val, iterator_datum.ty);
290291

291292
// Create our basic blocks and set up our loop cleanups.
@@ -365,6 +366,8 @@ pub fn trans_for<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
365366
llpayload,
366367
binding_cleanup_scope_id);
367368

369+
debuginfo::create_for_loop_var_metadata(body_bcx_in, pat);
370+
368371
// Codegen the body.
369372
body_bcx_out = trans_block(body_bcx_out, body, expr::Ignore);
370373
body_bcx_out =

0 commit comments

Comments
 (0)