Skip to content

Commit ff23e12

Browse files
committed
librustc: De-@mut BindingRscope::anon_bindings
1 parent d7b1527 commit ff23e12

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/librustc/middle/typeck/rscope.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
use middle::ty;
1313

14+
use std::cell::Cell;
1415
use std::vec;
1516
use syntax::ast;
1617
use syntax::codemap::Span;
@@ -49,14 +50,14 @@ impl RegionScope for ExplicitRscope {
4950
/// omitted regions. This occurs in function signatures.
5051
pub struct BindingRscope {
5152
binder_id: ast::NodeId,
52-
anon_bindings: @mut uint
53+
anon_bindings: Cell<uint>,
5354
}
5455

5556
impl BindingRscope {
5657
pub fn new(binder_id: ast::NodeId) -> BindingRscope {
5758
BindingRscope {
5859
binder_id: binder_id,
59-
anon_bindings: @mut 0
60+
anon_bindings: Cell::new(0),
6061
}
6162
}
6263
}
@@ -66,8 +67,8 @@ impl RegionScope for BindingRscope {
6667
_: Span,
6768
count: uint)
6869
-> 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);
7172
Ok(vec::from_fn(count, |i| ty::ReLateBound(self.binder_id,
7273
ty::BrAnon(idx + i))))
7374
}

0 commit comments

Comments
 (0)