Skip to content

Commit 73a7e0b

Browse files
committed
---
yaml --- r: 147595 b: refs/heads/try2 c: 2ae76e1 h: refs/heads/master i: 147593: e0b6605 147591: 8ec8032 v: v3
1 parent ad09523 commit 73a7e0b

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
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: fbb70d916f08e880c7f0ca576f7f56ea7a40ddc1
8+
refs/heads/try2: 2ae76e120aff2fac9293c64004827bdc14b5c63c
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/metadata/encoder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ use syntax;
4949
use writer = extra::ebml::writer;
5050

5151
// used by astencode:
52-
type abbrev_map = @mut HashMap<ty::t, tyencode::ty_abbrev>;
52+
type abbrev_map = @RefCell<HashMap<ty::t, tyencode::ty_abbrev>>;
5353

5454
pub type encode_inlined_item<'a> = 'a |ecx: &EncodeContext,
5555
ebml_w: &mut writer::Encoder,
@@ -1774,7 +1774,7 @@ pub fn encode_metadata(parms: EncodeParams, crate: &Crate) -> ~[u8] {
17741774
non_inlineable_statics,
17751775
..
17761776
} = parms;
1777-
let type_abbrevs = @mut HashMap::new();
1777+
let type_abbrevs = @RefCell::new(HashMap::new());
17781778
let stats = @mut stats;
17791779
let ecx = EncodeContext {
17801780
diag: diag,

branches/try2/src/librustc/metadata/tyencode.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
// Type encoding
1212

13+
use std::cell::RefCell;
1314
use std::hashmap::HashMap;
1415
use std::io;
1516
use std::io::{Decorator, Writer, Seek};
@@ -50,7 +51,7 @@ pub struct ty_abbrev {
5051

5152
pub enum abbrev_ctxt {
5253
ac_no_abbrevs,
53-
ac_use_abbrevs(@mut HashMap<ty::t, ty_abbrev>),
54+
ac_use_abbrevs(@RefCell<HashMap<ty::t, ty_abbrev>>),
5455
}
5556

5657
fn mywrite(w: &mut MemWriter, fmt: &fmt::Arguments) {
@@ -83,9 +84,12 @@ pub fn enc_ty(w: &mut MemWriter, cx: @ctxt, t: ty::t) {
8384
w.write(result_str.as_bytes());
8485
}
8586
ac_use_abbrevs(abbrevs) => {
86-
match abbrevs.find(&t) {
87-
Some(a) => { w.write(a.s.as_bytes()); return; }
88-
None => {}
87+
{
88+
let mut abbrevs = abbrevs.borrow_mut();
89+
match abbrevs.get().find(&t) {
90+
Some(a) => { w.write(a.s.as_bytes()); return; }
91+
None => {}
92+
}
8993
}
9094
let pos = w.tell();
9195
enc_sty(w, cx, &ty::get(t).sty);
@@ -104,7 +108,10 @@ pub fn enc_ty(w: &mut MemWriter, cx: @ctxt, t: ty::t) {
104108
let a = ty_abbrev { pos: pos as uint,
105109
len: len as uint,
106110
s: s };
107-
abbrevs.insert(t, a);
111+
{
112+
let mut abbrevs = abbrevs.borrow_mut();
113+
abbrevs.get().insert(t, a);
114+
}
108115
}
109116
return;
110117
}

0 commit comments

Comments
 (0)