diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-12-30 16:26:07 -0800 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2014-01-03 14:01:59 -0800 |
| commit | 39f39ed40bc7c8a2c01a61584fb88a723b3e62ca (patch) | |
| tree | 0fcf5b237beda73c359b402e991d8b7319044929 /src/libsyntax | |
| parent | 27cc3d203baf219ae06596e9ac44f0c394024bb5 (diff) | |
| download | rust-39f39ed40bc7c8a2c01a61584fb88a723b3e62ca.tar.gz rust-39f39ed40bc7c8a2c01a61584fb88a723b3e62ca.zip | |
libsyntax: De-`@mut` `FileMap::multibyte_chars`
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/codemap.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/ext/source_util.rs | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 80dc66405e1..67a70dae24a 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -223,7 +223,7 @@ pub struct FileMap { /// Locations of lines beginnings in the source code lines: RefCell<~[BytePos]>, /// Locations of multi-byte characters in the source code - multibyte_chars: @mut ~[MultiByteChar], + multibyte_chars: RefCell<~[MultiByteChar]>, } impl FileMap { @@ -258,7 +258,8 @@ impl FileMap { pos: pos, bytes: bytes, }; - self.multibyte_chars.push(mbc); + let mut multibyte_chars = self.multibyte_chars.borrow_mut(); + multibyte_chars.get().push(mbc); } pub fn is_real_file(&self) -> bool { @@ -300,7 +301,7 @@ impl CodeMap { name: filename, substr: substr, src: src, start_pos: Pos::from_uint(start_pos), lines: RefCell::new(~[]), - multibyte_chars: @mut ~[], + multibyte_chars: RefCell::new(~[]), }; files.push(filemap); @@ -471,7 +472,8 @@ impl CodeMap { // The number of extra bytes due to multibyte chars in the FileMap let mut total_extra_bytes = 0; - for mbc in map.multibyte_chars.iter() { + let multibyte_chars = map.multibyte_chars.borrow(); + for mbc in multibyte_chars.get().iter() { debug!("codemap: {:?}-byte char at {:?}", mbc.bytes, mbc.pos); if mbc.pos < bpos { total_extra_bytes += mbc.bytes; diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index 283e046c68a..7e73f2b9aaf 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -115,7 +115,7 @@ pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[ast::token_tree]) src: s, start_pos: codemap::BytePos(0), lines: RefCell::new(~[]), - multibyte_chars: @mut ~[], + multibyte_chars: RefCell::new(~[]), }); base::MRExpr(cx.expr_str(sp, s)) } |
