diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-12-22 14:42:50 -0800 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-12-26 15:54:36 -0800 |
| commit | ff23e1202f782adbd1b9f08dbcfbea5d257770ce (patch) | |
| tree | b7524a26d6ebc68857dfcc444d851206397f7f26 /src | |
| parent | d7b152701eba5f78bb9295c4fa60ad0a9ec3ff50 (diff) | |
| download | rust-ff23e1202f782adbd1b9f08dbcfbea5d257770ce.tar.gz rust-ff23e1202f782adbd1b9f08dbcfbea5d257770ce.zip | |
librustc: De-`@mut` `BindingRscope::anon_bindings`
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc/middle/typeck/rscope.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/librustc/middle/typeck/rscope.rs b/src/librustc/middle/typeck/rscope.rs index 9a32eafa8e4..4eb1ad9ab9a 100644 --- a/src/librustc/middle/typeck/rscope.rs +++ b/src/librustc/middle/typeck/rscope.rs @@ -11,6 +11,7 @@ use middle::ty; +use std::cell::Cell; use std::vec; use syntax::ast; use syntax::codemap::Span; @@ -49,14 +50,14 @@ impl RegionScope for ExplicitRscope { /// omitted regions. This occurs in function signatures. pub struct BindingRscope { binder_id: ast::NodeId, - anon_bindings: @mut uint + anon_bindings: Cell<uint>, } impl BindingRscope { pub fn new(binder_id: ast::NodeId) -> BindingRscope { BindingRscope { binder_id: binder_id, - anon_bindings: @mut 0 + anon_bindings: Cell::new(0), } } } @@ -66,8 +67,8 @@ impl RegionScope for BindingRscope { _: Span, count: uint) -> Result<~[ty::Region], ()> { - let idx = *self.anon_bindings; - *self.anon_bindings += count; + let idx = self.anon_bindings.get(); + self.anon_bindings.set(idx + count); Ok(vec::from_fn(count, |i| ty::ReLateBound(self.binder_id, ty::BrAnon(idx + i)))) } |
