From 39f39ed40bc7c8a2c01a61584fb88a723b3e62ca Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Mon, 30 Dec 2013 16:26:07 -0800 Subject: libsyntax: De-`@mut` `FileMap::multibyte_chars` --- src/libsyntax/codemap.rs | 10 ++++++---- src/libsyntax/ext/source_util.rs | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src/libsyntax') 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)) } -- cgit 1.4.1-3-g733a5