@@ -225,21 +225,12 @@ fn invalid_node() -> LiveNode { LiveNode(uint::MAX) }
225
225
226
226
struct CaptureInfo {
227
227
ln : LiveNode ,
228
- is_move : bool ,
229
228
var_nid : NodeId
230
229
}
231
230
232
- enum LocalKind {
233
- FromMatch ( BindingMode ) ,
234
- FromLetWithInitializer ,
235
- FromLetNoInitializer
236
- }
237
-
238
231
struct LocalInfo {
239
232
id : NodeId ,
240
- ident : Ident ,
241
- is_mutbl : bool ,
242
- kind : LocalKind ,
233
+ ident : Ident
243
234
}
244
235
245
236
enum VarKind {
@@ -405,23 +396,13 @@ fn visit_fn(ir: &mut IrMaps,
405
396
}
406
397
407
398
fn visit_local ( ir : & mut IrMaps , local : & Local ) {
408
- pat_util:: pat_bindings ( & ir. tcx . def_map , local. pat , |bm , p_id, sp, path| {
399
+ pat_util:: pat_bindings ( & ir. tcx . def_map , local. pat , |_ , p_id, sp, path| {
409
400
debug ! ( "adding local variable {}" , p_id) ;
410
401
let name = ast_util:: path_to_ident ( path) ;
411
402
ir. add_live_node_for_node ( p_id, VarDefNode ( sp) ) ;
412
- let kind = match local. init {
413
- Some ( _) => FromLetWithInitializer ,
414
- None => FromLetNoInitializer
415
- } ;
416
- let mutbl = match bm {
417
- BindByValue ( MutMutable ) => true ,
418
- _ => false
419
- } ;
420
403
ir. add_variable ( Local ( LocalInfo {
421
404
id : p_id,
422
- ident : name,
423
- is_mutbl : mutbl,
424
- kind : kind
405
+ ident : name
425
406
} ) ) ;
426
407
} ) ;
427
408
visit:: walk_local ( ir, local, ( ) ) ;
@@ -433,16 +414,10 @@ fn visit_arm(ir: &mut IrMaps, arm: &Arm) {
433
414
debug ! ( "adding local variable {} from match with bm {:?}" ,
434
415
p_id, bm) ;
435
416
let name = ast_util:: path_to_ident ( path) ;
436
- let mutbl = match bm {
437
- BindByValue ( MutMutable ) => true ,
438
- _ => false
439
- } ;
440
417
ir. add_live_node_for_node ( p_id, VarDefNode ( sp) ) ;
441
418
ir. add_variable ( Local ( LocalInfo {
442
419
id : p_id,
443
- ident : name,
444
- is_mutbl : mutbl,
445
- kind : FromMatch ( bm)
420
+ ident : name
446
421
} ) ) ;
447
422
} )
448
423
}
@@ -480,27 +455,12 @@ fn visit_expr(ir: &mut IrMaps, expr: &Expr) {
480
455
// in better error messages than just pointing at the closure
481
456
// construction site.
482
457
let mut call_caps = Vec :: new ( ) ;
483
- let fv_mode = freevars:: get_capture_mode ( ir. tcx , expr. id ) ;
484
458
freevars:: with_freevars ( ir. tcx , expr. id , |freevars| {
485
459
for fv in freevars. iter ( ) {
486
460
match moved_variable_node_id_from_def ( fv. def ) {
487
461
Some ( rv) => {
488
462
let fv_ln = ir. add_live_node ( FreeVarNode ( fv. span ) ) ;
489
- let fv_id = fv. def . def_id ( ) . node ;
490
- let fv_ty = ty:: node_id_to_type ( ir. tcx , fv_id) ;
491
- let is_move = match fv_mode {
492
- // var must be dead afterwards
493
- freevars:: CaptureByValue => {
494
- ty:: type_moves_by_default ( ir. tcx , fv_ty)
495
- }
496
-
497
- // var can still be used
498
- freevars:: CaptureByRef => {
499
- false
500
- }
501
- } ;
502
463
call_caps. push ( CaptureInfo { ln : fv_ln,
503
- is_move : is_move,
504
464
var_nid : rv} ) ;
505
465
}
506
466
None => { }
0 commit comments