Skip to content

Commit e0b6605

Browse files
committed
---
yaml --- r: 147593 b: refs/heads/try2 c: 4173785 h: refs/heads/master i: 147591: 8ec8032 v: v3
1 parent dbe0545 commit e0b6605

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 43aee50798d78a2e33410fcac462ded792c4c7b7
8+
refs/heads/try2: 417378554c076d2c3b42156fc046fd390587af41
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/driver/driver.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use middle;
2626
use util::common::time;
2727
use util::ppaux;
2828

29+
use std::cell::RefCell;
2930
use std::hashmap::{HashMap,HashSet};
3031
use std::io;
3132
use std::io::fs;
@@ -872,7 +873,7 @@ pub fn build_session_(sopts: @session::options,
872873
filesearch: filesearch,
873874
building_library: @mut false,
874875
working_dir: os::getcwd(),
875-
lints: @mut HashMap::new(),
876+
lints: RefCell::new(HashMap::new()),
876877
node_id: @mut 1,
877878
outputs: @mut ~[],
878879
}

branches/try2/src/librustc/driver/session.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ use syntax::abi;
2828
use syntax::parse::token;
2929
use syntax;
3030

31+
use std::cell::RefCell;
3132
use std::hashmap::{HashMap,HashSet};
3233

3334
pub struct config {
@@ -211,7 +212,8 @@ pub struct Session_ {
211212
filesearch: @filesearch::FileSearch,
212213
building_library: @mut bool,
213214
working_dir: Path,
214-
lints: @mut HashMap<ast::NodeId, ~[(lint::lint, codemap::Span, ~str)]>,
215+
lints: RefCell<HashMap<ast::NodeId,
216+
~[(lint::lint, codemap::Span, ~str)]>>,
215217
node_id: @mut ast::NodeId,
216218
outputs: @mut ~[OutputStyle],
217219
}
@@ -269,11 +271,12 @@ impl Session_ {
269271
id: ast::NodeId,
270272
sp: Span,
271273
msg: ~str) {
272-
match self.lints.find_mut(&id) {
274+
let mut lints = self.lints.borrow_mut();
275+
match lints.get().find_mut(&id) {
273276
Some(arr) => { arr.push((lint, sp, msg)); return; }
274277
None => {}
275278
}
276-
self.lints.insert(id, ~[(lint, sp, msg)]);
279+
lints.get().insert(id, ~[(lint, sp, msg)]);
277280
}
278281
pub fn next_node_id(&self) -> ast::NodeId {
279282
self.reserve_node_ids(1)

branches/try2/src/librustc/middle/lint.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,7 +1425,8 @@ impl<'a> Visitor<()> for Context<'a> {
14251425

14261426
impl<'a> IdVisitingOperation for Context<'a> {
14271427
fn visit_id(&self, id: ast::NodeId) {
1428-
match self.tcx.sess.lints.pop(&id) {
1428+
let mut lints = self.tcx.sess.lints.borrow_mut();
1429+
match lints.get().pop(&id) {
14291430
None => {}
14301431
Some(l) => {
14311432
for (lint, span, msg) in l.move_iter() {
@@ -1477,7 +1478,8 @@ pub fn check_crate(tcx: ty::ctxt,
14771478

14781479
// If we missed any lints added to the session, then there's a bug somewhere
14791480
// in the iteration code.
1480-
for (id, v) in tcx.sess.lints.iter() {
1481+
let lints = tcx.sess.lints.borrow();
1482+
for (id, v) in lints.get().iter() {
14811483
for &(lint, span, ref msg) in v.iter() {
14821484
tcx.sess.span_bug(span, format!("unprocessed lint {:?} at {}: {}",
14831485
lint,

0 commit comments

Comments
 (0)