Skip to content

Commit 3f6da6a

Browse files
committed
---
yaml --- r: 94712 b: refs/heads/try c: 5a9c37b h: refs/heads/master v: v3
1 parent a84d035 commit 3f6da6a

File tree

2 files changed

+15
-19
lines changed

2 files changed

+15
-19
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 0da105a8b7b6b1e0568e8ff20f6ff4b13cc7ecc2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d3e57dca68fde4effdda3e4ae2887aa535fcd6
5-
refs/heads/try: df0c13d2ea1bcbf999ea161e69707ccaad1c0771
5+
refs/heads/try: 5a9c37b7f53cf6dfb1f540c87e3a1d04f5d704ba
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/librustc/middle/borrowck/mod.rs

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use middle::dataflow::DataFlowContext;
1919
use middle::dataflow::DataFlowOperator;
2020
use util::ppaux::{note_and_explain_region, Repr, UserString};
2121

22-
use std::cell::RefCell;
22+
use std::cell::{Cell, RefCell};
2323
use std::hashmap::{HashSet, HashMap};
2424
use std::ops::{BitOr, BitAnd};
2525
use std::result::{Result};
@@ -84,11 +84,10 @@ pub fn check_crate(
8484
root_map: root_map(),
8585
write_guard_map: @RefCell::new(HashSet::new()),
8686
stats: @mut BorrowStats {
87-
loaned_paths_same: 0,
88-
loaned_paths_imm: 0,
89-
stable_paths: 0,
90-
req_pure_paths: 0,
91-
guaranteed_paths: 0,
87+
loaned_paths_same: Cell::new(0),
88+
loaned_paths_imm: Cell::new(0),
89+
stable_paths: Cell::new(0),
90+
guaranteed_paths: Cell::new(0),
9291
}
9392
};
9493
let bccx = &mut bccx;
@@ -98,22 +97,20 @@ pub fn check_crate(
9897
if tcx.sess.borrowck_stats() {
9998
println("--- borrowck stats ---");
10099
println!("paths requiring guarantees: {}",
101-
bccx.stats.guaranteed_paths);
100+
bccx.stats.guaranteed_paths.get());
102101
println!("paths requiring loans : {}",
103-
make_stat(bccx, bccx.stats.loaned_paths_same));
102+
make_stat(bccx, bccx.stats.loaned_paths_same.get()));
104103
println!("paths requiring imm loans : {}",
105-
make_stat(bccx, bccx.stats.loaned_paths_imm));
104+
make_stat(bccx, bccx.stats.loaned_paths_imm.get()));
106105
println!("stable paths : {}",
107-
make_stat(bccx, bccx.stats.stable_paths));
108-
println!("paths requiring purity : {}",
109-
make_stat(bccx, bccx.stats.req_pure_paths));
106+
make_stat(bccx, bccx.stats.stable_paths.get()));
110107
}
111108

112109
return (bccx.root_map, bccx.write_guard_map);
113110

114111
fn make_stat(bccx: &mut BorrowckCtxt, stat: uint) -> ~str {
115112
let stat_f = stat as f64;
116-
let total = bccx.stats.guaranteed_paths as f64;
113+
let total = bccx.stats.guaranteed_paths.get() as f64;
117114
format!("{} ({:.0f}%)", stat , stat_f * 100.0 / total)
118115
}
119116
}
@@ -179,11 +176,10 @@ pub struct BorrowckCtxt {
179176
}
180177

181178
pub struct BorrowStats {
182-
loaned_paths_same: uint,
183-
loaned_paths_imm: uint,
184-
stable_paths: uint,
185-
req_pure_paths: uint,
186-
guaranteed_paths: uint
179+
loaned_paths_same: Cell<uint>,
180+
loaned_paths_imm: Cell<uint>,
181+
stable_paths: Cell<uint>,
182+
guaranteed_paths: Cell<uint>,
187183
}
188184

189185
// The keys to the root map combine the `id` of the deref expression

0 commit comments

Comments
 (0)