From 4d66af2698fd2ff2d19d68cda4eb804b5d319e5b Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Fri, 27 Dec 2013 13:48:00 -0800 Subject: librustc: De-`@mut` the span handler --- src/libsyntax/parse/comments.rs | 2 +- src/libsyntax/parse/lexer.rs | 12 ++++++------ src/libsyntax/parse/mod.rs | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/libsyntax/parse') diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs index 248f5fe3ffb..e0ab7f1535d 100644 --- a/src/libsyntax/parse/comments.rs +++ b/src/libsyntax/parse/comments.rs @@ -347,7 +347,7 @@ pub struct lit { // it appears this function is called only from pprust... that's // probably not a good thing. pub fn gather_comments_and_literals(span_diagnostic: - @mut diagnostic::SpanHandler, + @diagnostic::SpanHandler, path: @str, srdr: &mut io::Reader) -> (~[cmnt], ~[lit]) { diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index e3b2c5406ba..5882749cdf1 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -29,7 +29,7 @@ pub trait reader { fn is_eof(@self) -> bool; fn next_token(@self) -> TokenAndSpan; fn fatal(@self, ~str) -> !; - fn span_diag(@self) -> @mut SpanHandler; + fn span_diag(@self) -> @SpanHandler; fn peek(@self) -> TokenAndSpan; fn dup(@self) -> @reader; } @@ -41,7 +41,7 @@ pub struct TokenAndSpan { } pub struct StringReader { - span_diagnostic: @mut SpanHandler, + span_diagnostic: @SpanHandler, src: @str, // The absolute offset within the codemap of the next character to read pos: Cell, @@ -57,7 +57,7 @@ pub struct StringReader { peek_span: RefCell, } -pub fn new_string_reader(span_diagnostic: @mut SpanHandler, +pub fn new_string_reader(span_diagnostic: @SpanHandler, filemap: @codemap::FileMap) -> @StringReader { let r = new_low_level_string_reader(span_diagnostic, filemap); @@ -66,7 +66,7 @@ pub fn new_string_reader(span_diagnostic: @mut SpanHandler, } /* For comments.rs, which hackily pokes into 'pos' and 'curr' */ -pub fn new_low_level_string_reader(span_diagnostic: @mut SpanHandler, +pub fn new_low_level_string_reader(span_diagnostic: @SpanHandler, filemap: @codemap::FileMap) -> @StringReader { // Force the initial reader bump to start on a fresh line @@ -121,7 +121,7 @@ impl reader for StringReader { fn fatal(@self, m: ~str) -> ! { self.span_diagnostic.span_fatal(self.peek_span.get(), m) } - fn span_diag(@self) -> @mut SpanHandler { self.span_diagnostic } + fn span_diag(@self) -> @SpanHandler { self.span_diagnostic } fn peek(@self) -> TokenAndSpan { // XXX(pcwalton): Bad copy! TokenAndSpan { @@ -145,7 +145,7 @@ impl reader for TtReader { fn fatal(@self, m: ~str) -> ! { self.sp_diag.span_fatal(self.cur_span.get(), m); } - fn span_diag(@self) -> @mut SpanHandler { self.sp_diag } + fn span_diag(@self) -> @SpanHandler { self.sp_diag } fn peek(@self) -> TokenAndSpan { TokenAndSpan { tok: self.cur_tok.get(), diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 21fdf1d2327..c20e7f4aaec 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -42,7 +42,7 @@ pub mod obsolete; // info about a parsing session. pub struct ParseSess { cm: @codemap::CodeMap, // better be the same as the one in the reader! - span_diagnostic: @mut SpanHandler, // better be the same as the one in the reader! + span_diagnostic: @SpanHandler, // better be the same as the one in the reader! /// Used to determine and report recursive mod inclusions included_mod_stack: RefCell<~[Path]>, } @@ -56,9 +56,9 @@ pub fn new_parse_sess(demitter: Option<@Emitter>) -> @ParseSess { } } -pub fn new_parse_sess_special_handler(sh: @mut SpanHandler, +pub fn new_parse_sess_special_handler(sh: @SpanHandler, cm: @codemap::CodeMap) - -> @ParseSess { + -> @ParseSess { @ParseSess { cm: cm, span_diagnostic: sh, -- cgit 1.4.1-3-g733a5