File tree 1 file changed +5
-4
lines changed
src/librustc/middle/typeck
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 11
11
12
12
use middle:: ty;
13
13
14
+ use std:: cell:: Cell ;
14
15
use std:: vec;
15
16
use syntax:: ast;
16
17
use syntax:: codemap:: Span ;
@@ -49,14 +50,14 @@ impl RegionScope for ExplicitRscope {
49
50
/// omitted regions. This occurs in function signatures.
50
51
pub struct BindingRscope {
51
52
binder_id : ast:: NodeId ,
52
- anon_bindings : @ mut uint
53
+ anon_bindings : Cell < uint > ,
53
54
}
54
55
55
56
impl BindingRscope {
56
57
pub fn new ( binder_id : ast:: NodeId ) -> BindingRscope {
57
58
BindingRscope {
58
59
binder_id : binder_id,
59
- anon_bindings : @ mut 0
60
+ anon_bindings : Cell :: new ( 0 ) ,
60
61
}
61
62
}
62
63
}
@@ -66,8 +67,8 @@ impl RegionScope for BindingRscope {
66
67
_: Span ,
67
68
count : uint )
68
69
-> Result < ~[ ty:: Region ] , ( ) > {
69
- let idx = * self . anon_bindings ;
70
- * self . anon_bindings += count;
70
+ let idx = self . anon_bindings . get ( ) ;
71
+ self . anon_bindings . set ( idx + count) ;
71
72
Ok ( vec:: from_fn ( count, |i| ty:: ReLateBound ( self . binder_id ,
72
73
ty:: BrAnon ( idx + i) ) ) )
73
74
}
You can’t perform that action at this time.
0 commit comments