@@ -29,10 +29,10 @@ tag ret_info { by_ref(bool, node_id); other; }
29
29
type scope = { bs : [ binding ] , ret_info : ret_info } ;
30
30
31
31
fn mk_binding ( cx : ctx , id : node_id , span : span , root_var : option:: t < node_id > ,
32
- unsafe : [ unsafe_ty ] ) -> binding {
32
+ unsafe_tys : [ unsafe_ty ] ) -> binding {
33
33
ret @{ node_id : id, span : span, root_var : root_var,
34
34
local_id : local_id_of_node ( cx, id) ,
35
- unsafe_tys : unsafe , mutable ok: valid,
35
+ unsafe_tys : unsafe_tys , mutable ok: valid,
36
36
mutable copied: not_copied} ;
37
37
}
38
38
@@ -284,12 +284,12 @@ fn check_call(cx: ctx, f: @ast::expr, args: [@ast::expr]) -> [binding] {
284
284
}
285
285
let j = 0 u;
286
286
for b in bindings {
287
- for unsafe in b. unsafe_tys {
287
+ for unsafe_ty in b. unsafe_tys {
288
288
let i = 0 u;
289
289
for arg_t: ty:: arg in arg_ts {
290
290
let mut_alias = arg_t. mode == ast:: by_mut_ref;
291
291
if i != j &&
292
- ty_can_unsafely_include ( cx, unsafe , arg_t. ty ,
292
+ ty_can_unsafely_include ( cx, unsafe_ty , arg_t. ty ,
293
293
mut_alias) &&
294
294
cant_copy ( cx, b) {
295
295
cx. tcx . sess . span_err
@@ -397,24 +397,28 @@ fn check_alt(cx: ctx, input: @ast::expr, arms: [ast::arm], sc: scope,
397
397
let new_bs = sc. bs ;
398
398
let root_var = path_def_id ( cx, root. ex ) ;
399
399
let pat_id_map = ast_util:: pat_id_map ( a. pats [ 0 ] ) ;
400
- type info = { id : node_id , mutable unsafe: [ unsafe_ty ] , span : span } ;
400
+ type info = {
401
+ id : node_id ,
402
+ mutable unsafe_tys: [ unsafe_ty ] ,
403
+ span : span } ;
401
404
let binding_info: [ info ] = [ ] ;
402
405
for pat in a. pats {
403
406
for proot in pattern_roots ( cx. tcx , root. mut , pat) {
404
407
let canon_id = pat_id_map. get ( proot. name ) ;
405
408
alt vec:: find ( { |x| x. id == canon_id} , binding_info) {
406
- some ( s) { s. unsafe += unsafe_set ( proot. mut ) ; }
409
+ some ( s) { s. unsafe_tys += unsafe_set ( proot. mut ) ; }
407
410
none. {
408
- binding_info += [ { id: canon_id,
409
- mutable unsafe: unsafe_set ( proot. mut ) ,
410
- span: proot. span } ] ;
411
+ binding_info += [
412
+ { id: canon_id,
413
+ mutable unsafe_tys: unsafe_set ( proot. mut ) ,
414
+ span: proot. span } ] ;
411
415
}
412
416
}
413
417
}
414
418
}
415
419
for info in binding_info {
416
420
new_bs += [ mk_binding ( cx, info. id , info. span , root_var,
417
- copy info. unsafe ) ] ;
421
+ copy info. unsafe_tys ) ] ;
418
422
}
419
423
visit:: visit_arm ( a, { bs: new_bs with sc} , v) ;
420
424
}
@@ -470,8 +474,8 @@ fn check_var(cx: ctx, ex: @ast::expr, p: ast::path, id: ast::node_id,
470
474
for b in sc. bs {
471
475
// excludes variables introduced since the alias was made
472
476
if my_local_id < b. local_id {
473
- for unsafe in b. unsafe_tys {
474
- if ty_can_unsafely_include ( cx, unsafe , var_t, assign) {
477
+ for unsafe_ty in b. unsafe_tys {
478
+ if ty_can_unsafely_include ( cx, unsafe_ty , var_t, assign) {
475
479
b. ok = val_taken ( ex. span , p) ;
476
480
}
477
481
}
@@ -689,9 +693,9 @@ fn pattern_roots(tcx: ty::ctxt, mut: option::t<unsafe_ty>, pat: @ast::pat)
689
693
fn expr_root ( cx : ctx , ex : @ast:: expr , autoderef : bool )
690
694
-> { ex : @ast:: expr , mut : option:: t < unsafe_ty > } {
691
695
let base_root = mut:: expr_root ( cx. tcx , ex, autoderef) ;
692
- let unsafe = none;
696
+ let unsafe_ty = none;
693
697
for d in * base_root. ds {
694
- if d. mut { unsafe = some ( contains ( d. outer_t ) ) ; break ; }
698
+ if d. mut { unsafe_ty = some ( contains ( d. outer_t ) ) ; break ; }
695
699
}
696
700
if is_none ( path_def_id ( cx, base_root. ex ) ) {
697
701
alt base_root. ex . node {
@@ -703,18 +707,18 @@ fn expr_root(cx: ctx, ex: @ast::expr, autoderef: bool)
703
707
let arg_root = expr_root ( cx, arg, false ) ;
704
708
if mut {
705
709
let ret_ty = ty:: expr_ty ( cx. tcx , base_root. ex ) ;
706
- unsafe = some ( mut_contains ( ret_ty) ) ;
710
+ unsafe_ty = some ( mut_contains ( ret_ty) ) ;
707
711
}
708
- if !is_none ( arg_root. mut ) { unsafe = arg_root. mut ; }
709
- ret { ex : arg_root. ex , mut: unsafe } ;
712
+ if !is_none ( arg_root. mut ) { unsafe_ty = arg_root. mut ; }
713
+ ret { ex : arg_root. ex , mut : unsafe_ty } ;
710
714
}
711
715
_ { }
712
716
}
713
717
}
714
718
_ { }
715
719
}
716
720
}
717
- ret { ex : base_root. ex , mut: unsafe } ;
721
+ ret { ex : base_root. ex , mut : unsafe_ty } ;
718
722
}
719
723
720
724
fn unsafe_set ( from : option:: t < unsafe_ty > ) -> [ unsafe_ty ] {
0 commit comments