about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-12-27 13:48:00 -0800
committerPatrick Walton <pcwalton@mimiga.net>2014-01-03 14:01:57 -0800
commit4d66af2698fd2ff2d19d68cda4eb804b5d319e5b (patch)
tree73a86f33d06e630b2c45d81532c1f9bda62627d5 /src/libsyntax
parent7e1b535eb1aa7614e40538ca5892a71199f804b9 (diff)
downloadrust-4d66af2698fd2ff2d19d68cda4eb804b5d319e5b.tar.gz
rust-4d66af2698fd2ff2d19d68cda4eb804b5d319e5b.zip
librustc: De-`@mut` the span handler
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast_map.rs6
-rw-r--r--src/libsyntax/attr.rs5
-rw-r--r--src/libsyntax/diagnostic.rs23
-rw-r--r--src/libsyntax/ext/tt/transcribe.rs6
-rw-r--r--src/libsyntax/parse/comments.rs2
-rw-r--r--src/libsyntax/parse/lexer.rs12
-rw-r--r--src/libsyntax/parse/mod.rs6
-rw-r--r--src/libsyntax/print/pprust.rs2
8 files changed, 29 insertions, 33 deletions
diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs
index 504a51f80a8..b7532ad72cb 100644
--- a/src/libsyntax/ast_map.rs
+++ b/src/libsyntax/ast_map.rs
@@ -197,7 +197,7 @@ pub type map = @mut HashMap<NodeId, ast_node>;
 pub struct Ctx {
     map: map,
     path: path,
-    diag: @mut SpanHandler,
+    diag: @SpanHandler,
 }
 
 impl Ctx {
@@ -418,7 +418,7 @@ impl Visitor<()> for Ctx {
     }
 }
 
-pub fn map_crate(diag: @mut SpanHandler, c: &Crate) -> map {
+pub fn map_crate(diag: @SpanHandler, c: &Crate) -> map {
     let cx = @mut Ctx {
         map: @mut HashMap::new(),
         path: ~[],
@@ -431,7 +431,7 @@ pub fn map_crate(diag: @mut SpanHandler, c: &Crate) -> map {
 // Used for items loaded from external crate that are being inlined into this
 // crate.  The `path` should be the path to the item but should not include
 // the item itself.
-pub fn map_decoded_item(diag: @mut SpanHandler,
+pub fn map_decoded_item(diag: @SpanHandler,
                         map: map,
                         path: path,
                         ii: &inlined_item) {
diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs
index 7a3ac0f2f4d..df8b45dbcf5 100644
--- a/src/libsyntax/attr.rs
+++ b/src/libsyntax/attr.rs
@@ -355,8 +355,7 @@ pub fn find_stability<AM: AttrMetaMethods, It: Iterator<AM>>(mut metas: It) -> O
     None
 }
 
-pub fn require_unique_names(diagnostic: @mut SpanHandler,
-                            metas: &[@MetaItem]) {
+pub fn require_unique_names(diagnostic: @SpanHandler, metas: &[@MetaItem]) {
     let mut set = HashSet::new();
     for meta in metas.iter() {
         let name = meta.name();
@@ -381,7 +380,7 @@ pub fn require_unique_names(diagnostic: @mut SpanHandler,
  * present (before fields, if any) with that type; reprensentation
  * optimizations which would remove it will not be done.
  */
-pub fn find_repr_attr(diagnostic: @mut SpanHandler, attr: @ast::MetaItem, acc: ReprAttr)
+pub fn find_repr_attr(diagnostic: @SpanHandler, attr: @ast::MetaItem, acc: ReprAttr)
     -> ReprAttr {
     let mut acc = acc;
     match attr.node {
diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs
index c905281cdb2..bb7cb81a31a 100644
--- a/src/libsyntax/diagnostic.rs
+++ b/src/libsyntax/diagnostic.rs
@@ -35,27 +35,27 @@ pub struct SpanHandler {
 }
 
 impl SpanHandler {
-    pub fn span_fatal(@mut self, sp: Span, msg: &str) -> ! {
+    pub fn span_fatal(@self, sp: Span, msg: &str) -> ! {
         self.handler.emit(Some((&*self.cm, sp)), msg, fatal);
         fail!();
     }
-    pub fn span_err(@mut self, sp: Span, msg: &str) {
+    pub fn span_err(@self, sp: Span, msg: &str) {
         self.handler.emit(Some((&*self.cm, sp)), msg, error);
         self.handler.bump_err_count();
     }
-    pub fn span_warn(@mut self, sp: Span, msg: &str) {
+    pub fn span_warn(@self, sp: Span, msg: &str) {
         self.handler.emit(Some((&*self.cm, sp)), msg, warning);
     }
-    pub fn span_note(@mut self, sp: Span, msg: &str) {
+    pub fn span_note(@self, sp: Span, msg: &str) {
         self.handler.emit(Some((&*self.cm, sp)), msg, note);
     }
-    pub fn span_bug(@mut self, sp: Span, msg: &str) -> ! {
+    pub fn span_bug(@self, sp: Span, msg: &str) -> ! {
         self.span_fatal(sp, ice_msg(msg));
     }
-    pub fn span_unimpl(@mut self, sp: Span, msg: &str) -> ! {
+    pub fn span_unimpl(@self, sp: Span, msg: &str) -> ! {
         self.span_bug(sp, ~"unimplemented " + msg);
     }
-    pub fn handler(@mut self) -> @mut Handler {
+    pub fn handler(@self) -> @mut Handler {
         self.handler
     }
 }
@@ -124,8 +124,8 @@ pub fn ice_msg(msg: &str) -> ~str {
 }
 
 pub fn mk_span_handler(handler: @mut Handler, cm: @codemap::CodeMap)
-                    -> @mut SpanHandler {
-    @mut SpanHandler {
+                       -> @SpanHandler {
+    @SpanHandler {
         handler: handler,
         cm: cm,
     }
@@ -327,10 +327,7 @@ fn print_macro_backtrace(cm: &codemap::CodeMap, sp: Span) {
     }
 }
 
-pub fn expect<T:Clone>(
-              diag: @mut SpanHandler,
-              opt: Option<T>,
-              msg: || -> ~str)
+pub fn expect<T:Clone>(diag: @SpanHandler, opt: Option<T>, msg: || -> ~str)
               -> T {
     match opt {
        Some(ref t) => (*t).clone(),
diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs
index f4c7132a1f6..9827c02d4b8 100644
--- a/src/libsyntax/ext/tt/transcribe.rs
+++ b/src/libsyntax/ext/tt/transcribe.rs
@@ -31,7 +31,7 @@ struct TtFrame {
 }
 
 pub struct TtReader {
-    sp_diag: @mut SpanHandler,
+    sp_diag: @SpanHandler,
     // the unzipped tree:
     priv stack: RefCell<@mut TtFrame>,
     /* for MBE-style macro transcription */
@@ -46,10 +46,10 @@ pub struct TtReader {
 /** This can do Macro-By-Example transcription. On the other hand, if
  *  `src` contains no `tt_seq`s and `tt_nonterminal`s, `interp` can (and
  *  should) be none. */
-pub fn new_tt_reader(sp_diag: @mut SpanHandler,
+pub fn new_tt_reader(sp_diag: @SpanHandler,
                      interp: Option<HashMap<Ident,@named_match>>,
                      src: ~[ast::token_tree])
-                  -> @TtReader {
+                     -> @TtReader {
     let r = @TtReader {
         sp_diag: sp_diag,
         stack: RefCell::new(@mut TtFrame {
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<BytePos>,
@@ -57,7 +57,7 @@ pub struct StringReader {
     peek_span: RefCell<Span>,
 }
 
-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,
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 79ef9c2cbbe..c13bae777c6 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -118,7 +118,7 @@ pub static default_columns: uint = 78u;
 // copy forward.
 pub fn print_crate(cm: @CodeMap,
                    intr: @ident_interner,
-                   span_diagnostic: @mut diagnostic::SpanHandler,
+                   span_diagnostic: @diagnostic::SpanHandler,
                    crate: &ast::Crate,
                    filename: @str,
                    input: @mut io::Reader,