about summary refs log tree commit diff
diff options
context:
space:
mode:
authorklutzy <klutzytheklutzy@gmail.com>2013-12-31 23:17:59 +0900
committerklutzy <klutzytheklutzy@gmail.com>2014-01-01 19:10:43 +0900
commitfe10c63326eee6220900dcbb92197ccf26e2025b (patch)
treed19b12845e153c61d0d68267b50e93afc2f4f3a4
parenta52cdfdfce58c3fda80d4503a2b198546f96b6c0 (diff)
downloadrust-fe10c63326eee6220900dcbb92197ccf26e2025b.tar.gz
rust-fe10c63326eee6220900dcbb92197ccf26e2025b.zip
syntax::diagnostic: Remove unnecessary traits
This removes trait `handler` and `span_handler`,
and renames `HandlerT` to `Handler`, `CodemapT` to `SpanHandler`.
-rw-r--r--src/librustc/driver/driver.rs2
-rw-r--r--src/librustc/driver/session.rs4
-rw-r--r--src/librustc/metadata/creader.rs4
-rw-r--r--src/librustc/metadata/encoder.rs6
-rw-r--r--src/librustc/metadata/loader.rs6
-rw-r--r--src/librustc/metadata/tyencode.rs4
-rw-r--r--src/librustc/middle/ty.rs2
-rw-r--r--src/libsyntax/ast_map.rs8
-rw-r--r--src/libsyntax/attr.rs6
-rw-r--r--src/libsyntax/diagnostic.rs104
-rw-r--r--src/libsyntax/ext/base.rs1
-rw-r--r--src/libsyntax/ext/tt/transcribe.rs6
-rw-r--r--src/libsyntax/parse/comments.rs2
-rw-r--r--src/libsyntax/parse/lexer.rs14
-rw-r--r--src/libsyntax/parse/mod.rs6
-rw-r--r--src/libsyntax/print/pprust.rs2
16 files changed, 74 insertions, 103 deletions
diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs
index 7d5846ebd6a..c4a3e21cbad 100644
--- a/src/librustc/driver/driver.rs
+++ b/src/librustc/driver/driver.rs
@@ -883,7 +883,7 @@ pub fn build_session(sopts: @session::options, demitter: @diagnostic::Emitter)
 pub fn build_session_(sopts: @session::options,
                       cm: @codemap::CodeMap,
                       demitter: @diagnostic::Emitter,
-                      span_diagnostic_handler: @mut diagnostic::span_handler)
+                      span_diagnostic_handler: @mut diagnostic::SpanHandler)
                       -> Session {
     let target_cfg = build_target_config(sopts, demitter);
     let p_s = parse::new_parse_sess_special_handler(span_diagnostic_handler,
diff --git a/src/librustc/driver/session.rs b/src/librustc/driver/session.rs
index 55822b66ae4..3f9274bc901 100644
--- a/src/librustc/driver/session.rs
+++ b/src/librustc/driver/session.rs
@@ -209,7 +209,7 @@ pub struct Session_ {
     // For a library crate, this is always none
     entry_fn: RefCell<Option<(NodeId, codemap::Span)>>,
     entry_type: Cell<Option<EntryFnType>>,
-    span_diagnostic: @mut diagnostic::span_handler,
+    span_diagnostic: @mut diagnostic::SpanHandler,
     filesearch: @filesearch::FileSearch,
     building_library: Cell<bool>,
     working_dir: Path,
@@ -292,7 +292,7 @@ impl Session_ {
 
         v
     }
-    pub fn diagnostic(&self) -> @mut diagnostic::span_handler {
+    pub fn diagnostic(&self) -> @mut diagnostic::SpanHandler {
         self.span_diagnostic
     }
     pub fn debugging_opt(&self, opt: uint) -> bool {
diff --git a/src/librustc/metadata/creader.rs b/src/librustc/metadata/creader.rs
index 8fa1e556394..673caa04487 100644
--- a/src/librustc/metadata/creader.rs
+++ b/src/librustc/metadata/creader.rs
@@ -22,7 +22,7 @@ use syntax::abi;
 use syntax::attr;
 use syntax::attr::AttrMetaMethods;
 use syntax::codemap::{Span, dummy_sp};
-use syntax::diagnostic::span_handler;
+use syntax::diagnostic::SpanHandler;
 use syntax::parse::token;
 use syntax::parse::token::ident_interner;
 use syntax::crateid::CrateId;
@@ -86,7 +86,7 @@ fn dump_crates(crate_cache: &[cache_entry]) {
 }
 
 fn warn_if_multiple_versions(e: &mut Env,
-                             diag: @mut span_handler,
+                             diag: @mut SpanHandler,
                              crate_cache: &[cache_entry]) {
     if crate_cache.len() != 0u {
         let name = crate_cache[crate_cache.len() - 1].crateid.name.clone();
diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs
index 73b0ac46cbd..6aa5f11c320 100644
--- a/src/librustc/metadata/encoder.rs
+++ b/src/librustc/metadata/encoder.rs
@@ -39,7 +39,7 @@ use syntax::ast_map;
 use syntax::ast_util::*;
 use syntax::attr;
 use syntax::attr::AttrMetaMethods;
-use syntax::diagnostic::span_handler;
+use syntax::diagnostic::SpanHandler;
 use syntax::parse::token::special_idents;
 use syntax::ast_util;
 use syntax::visit::Visitor;
@@ -57,7 +57,7 @@ pub type encode_inlined_item<'a> = 'a |ecx: &EncodeContext,
                                              ii: ast::inlined_item|;
 
 pub struct EncodeParams<'a> {
-    diag: @mut span_handler,
+    diag: @mut SpanHandler,
     tcx: ty::ctxt,
     reexports2: middle::resolve::ExportMap2,
     item_symbols: &'a RefCell<HashMap<ast::NodeId, ~str>>,
@@ -83,7 +83,7 @@ struct Stats {
 }
 
 pub struct EncodeContext<'a> {
-    diag: @mut span_handler,
+    diag: @mut SpanHandler,
     tcx: ty::ctxt,
     stats: @Stats,
     reexports2: middle::resolve::ExportMap2,
diff --git a/src/librustc/metadata/loader.rs b/src/librustc/metadata/loader.rs
index 481a43d1ced..37e6a46d6ba 100644
--- a/src/librustc/metadata/loader.rs
+++ b/src/librustc/metadata/loader.rs
@@ -19,7 +19,7 @@ use metadata::encoder;
 use metadata::filesearch::{FileMatches, FileDoesntMatch};
 use metadata::filesearch;
 use syntax::codemap::Span;
-use syntax::diagnostic::span_handler;
+use syntax::diagnostic::SpanHandler;
 use syntax::parse::token::ident_interner;
 use syntax::crateid::CrateId;
 use syntax::attr;
@@ -231,8 +231,8 @@ impl Context {
     }
 }
 
-pub fn note_crateid_attr(diag: @mut span_handler,
-                       crateid: &CrateId) {
+pub fn note_crateid_attr(diag: @mut SpanHandler,
+                         crateid: &CrateId) {
     diag.handler().note(format!("crate_id: {}", crateid.to_str()));
 }
 
diff --git a/src/librustc/metadata/tyencode.rs b/src/librustc/metadata/tyencode.rs
index 1f9f1e18565..e6ed70bd4dc 100644
--- a/src/librustc/metadata/tyencode.rs
+++ b/src/librustc/metadata/tyencode.rs
@@ -24,7 +24,7 @@ use middle::ty;
 use syntax::abi::AbiSet;
 use syntax::ast;
 use syntax::ast::*;
-use syntax::diagnostic::span_handler;
+use syntax::diagnostic::SpanHandler;
 use syntax::print::pprust::*;
 
 macro_rules! mywrite( ($wr:expr, $($arg:tt)*) => (
@@ -32,7 +32,7 @@ macro_rules! mywrite( ($wr:expr, $($arg:tt)*) => (
 ) )
 
 pub struct ctxt {
-    diag: @mut span_handler,
+    diag: @mut SpanHandler,
     // Def -> str Callback:
     ds: extern "Rust" fn(DefId) -> ~str,
     // The type context.
diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs
index a3c2e2a4404..78b06d62480 100644
--- a/src/librustc/middle/ty.rs
+++ b/src/librustc/middle/ty.rs
@@ -267,7 +267,7 @@ pub type ctxt = @ctxt_;
 /// generates so that so that it can be reused and doesn't have to be redone
 /// later on.
 struct ctxt_ {
-    diag: @mut syntax::diagnostic::span_handler,
+    diag: @mut syntax::diagnostic::SpanHandler,
     interner: RefCell<HashMap<intern_key, ~t_box_>>,
     next_id: Cell<uint>,
     cstore: @metadata::cstore::CStore,
diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs
index 63e8251b22c..3a2c0651ed9 100644
--- a/src/libsyntax/ast_map.rs
+++ b/src/libsyntax/ast_map.rs
@@ -15,7 +15,7 @@ use ast_util::{inlined_item_utils, stmt_id};
 use ast_util;
 use codemap::Span;
 use codemap;
-use diagnostic::span_handler;
+use diagnostic::SpanHandler;
 use parse::token::get_ident_interner;
 use parse::token::ident_interner;
 use parse::token::special_idents;
@@ -152,7 +152,7 @@ pub type map = @mut HashMap<NodeId, ast_node>;
 pub struct Ctx {
     map: map,
     path: path,
-    diag: @mut span_handler,
+    diag: @mut SpanHandler,
 }
 
 impl Ctx {
@@ -373,7 +373,7 @@ impl Visitor<()> for Ctx {
     }
 }
 
-pub fn map_crate(diag: @mut span_handler, c: &Crate) -> map {
+pub fn map_crate(diag: @mut SpanHandler, c: &Crate) -> map {
     let cx = @mut Ctx {
         map: @mut HashMap::new(),
         path: ~[],
@@ -386,7 +386,7 @@ pub fn map_crate(diag: @mut span_handler, 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 span_handler,
+pub fn map_decoded_item(diag: @mut SpanHandler,
                         map: map,
                         path: path,
                         ii: &inlined_item) {
diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs
index f2526c29b9a..7a3ac0f2f4d 100644
--- a/src/libsyntax/attr.rs
+++ b/src/libsyntax/attr.rs
@@ -14,7 +14,7 @@ use ast;
 use ast::{Attribute, Attribute_, MetaItem, MetaWord, MetaNameValue, MetaList};
 use codemap::{Span, Spanned, spanned, dummy_spanned};
 use codemap::BytePos;
-use diagnostic::span_handler;
+use diagnostic::SpanHandler;
 use parse::comments::{doc_comment_style, strip_doc_comment_decoration};
 use crateid::CrateId;
 
@@ -355,7 +355,7 @@ pub fn find_stability<AM: AttrMetaMethods, It: Iterator<AM>>(mut metas: It) -> O
     None
 }
 
-pub fn require_unique_names(diagnostic: @mut span_handler,
+pub fn require_unique_names(diagnostic: @mut SpanHandler,
                             metas: &[@MetaItem]) {
     let mut set = HashSet::new();
     for meta in metas.iter() {
@@ -381,7 +381,7 @@ pub fn require_unique_names(diagnostic: @mut span_handler,
  * 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 span_handler, attr: @ast::MetaItem, acc: ReprAttr)
+pub fn find_repr_attr(diagnostic: @mut 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 59f33bc7769..e53c0c39281 100644
--- a/src/libsyntax/diagnostic.rs
+++ b/src/libsyntax/diagnostic.rs
@@ -26,95 +26,67 @@ pub trait Emitter {
             lvl: level);
 }
 
-// a handler deals with errors; certain errors
-// (fatal, bug, unimpl) may cause immediate exit,
-// others log errors for later reporting.
-pub trait handler {
-    fn fatal(@mut self, msg: &str) -> !;
-    fn err(@mut self, msg: &str);
-    fn bump_err_count(@mut self);
-    fn err_count(@mut self) -> uint;
-    fn has_errors(@mut self) -> bool;
-    fn abort_if_errors(@mut self);
-    fn warn(@mut self, msg: &str);
-    fn note(@mut self, msg: &str);
-    // used to indicate a bug in the compiler:
-    fn bug(@mut self, msg: &str) -> !;
-    fn unimpl(@mut self, msg: &str) -> !;
-    fn emit(@mut self,
-            cmsp: Option<(@codemap::CodeMap, Span)>,
-            msg: &str,
-            lvl: level);
-}
-
 // a span-handler is like a handler but also
 // accepts span information for source-location
 // reporting.
-pub trait span_handler {
-    fn span_fatal(@mut self, sp: Span, msg: &str) -> !;
-    fn span_err(@mut self, sp: Span, msg: &str);
-    fn span_warn(@mut self, sp: Span, msg: &str);
-    fn span_note(@mut self, sp: Span, msg: &str);
-    fn span_bug(@mut self, sp: Span, msg: &str) -> !;
-    fn span_unimpl(@mut self, sp: Span, msg: &str) -> !;
-    fn handler(@mut self) -> @mut handler;
-}
-
-struct HandlerT {
-    err_count: uint,
-    emit: @Emitter,
-}
-
-struct CodemapT {
-    handler: @mut handler,
+pub struct SpanHandler {
+    handler: @mut Handler,
     cm: @codemap::CodeMap,
 }
 
-impl span_handler for CodemapT {
-    fn span_fatal(@mut self, sp: Span, msg: &str) -> ! {
+impl SpanHandler {
+    pub fn span_fatal(@mut self, sp: Span, msg: &str) -> ! {
         self.handler.emit(Some((self.cm, sp)), msg, fatal);
         fail!();
     }
-    fn span_err(@mut self, sp: Span, msg: &str) {
+    pub fn span_err(@mut self, sp: Span, msg: &str) {
         self.handler.emit(Some((self.cm, sp)), msg, error);
         self.handler.bump_err_count();
     }
-    fn span_warn(@mut self, sp: Span, msg: &str) {
+    pub fn span_warn(@mut self, sp: Span, msg: &str) {
         self.handler.emit(Some((self.cm, sp)), msg, warning);
     }
-    fn span_note(@mut self, sp: Span, msg: &str) {
+    pub fn span_note(@mut self, sp: Span, msg: &str) {
         self.handler.emit(Some((self.cm, sp)), msg, note);
     }
-    fn span_bug(@mut self, sp: Span, msg: &str) -> ! {
+    pub fn span_bug(@mut self, sp: Span, msg: &str) -> ! {
         self.span_fatal(sp, ice_msg(msg));
     }
-    fn span_unimpl(@mut self, sp: Span, msg: &str) -> ! {
+    pub fn span_unimpl(@mut self, sp: Span, msg: &str) -> ! {
         self.span_bug(sp, ~"unimplemented " + msg);
     }
-    fn handler(@mut self) -> @mut handler {
+    pub fn handler(@mut self) -> @mut Handler {
         self.handler
     }
 }
 
-impl handler for HandlerT {
-    fn fatal(@mut self, msg: &str) -> ! {
+// a handler deals with errors; certain errors
+// (fatal, bug, unimpl) may cause immediate exit,
+// others log errors for later reporting.
+pub struct Handler {
+    err_count: uint,
+    emit: @Emitter,
+}
+
+impl Handler {
+    pub fn fatal(@mut self, msg: &str) -> ! {
         self.emit.emit(None, msg, fatal);
         fail!();
     }
-    fn err(@mut self, msg: &str) {
+    pub fn err(@mut self, msg: &str) {
         self.emit.emit(None, msg, error);
         self.bump_err_count();
     }
-    fn bump_err_count(@mut self) {
+    pub fn bump_err_count(@mut self) {
         self.err_count += 1u;
     }
-    fn err_count(@mut self) -> uint {
+    pub fn err_count(@mut self) -> uint {
         self.err_count
     }
-    fn has_errors(@mut self) -> bool {
+    pub fn has_errors(@mut self) -> bool {
         self.err_count > 0u
     }
-    fn abort_if_errors(@mut self) {
+    pub fn abort_if_errors(@mut self) {
         let s;
         match self.err_count {
           0u => return,
@@ -126,19 +98,19 @@ impl handler for HandlerT {
         }
         self.fatal(s);
     }
-    fn warn(@mut self, msg: &str) {
+    pub fn warn(@mut self, msg: &str) {
         self.emit.emit(None, msg, warning);
     }
-    fn note(@mut self, msg: &str) {
+    pub fn note(@mut self, msg: &str) {
         self.emit.emit(None, msg, note);
     }
-    fn bug(@mut self, msg: &str) -> ! {
+    pub fn bug(@mut self, msg: &str) -> ! {
         self.fatal(ice_msg(msg));
     }
-    fn unimpl(@mut self, msg: &str) -> ! {
+    pub fn unimpl(@mut self, msg: &str) -> ! {
         self.bug(~"unimplemented " + msg);
     }
-    fn emit(@mut self,
+    pub fn emit(@mut self,
             cmsp: Option<(@codemap::CodeMap, Span)>,
             msg: &str,
             lvl: level) {
@@ -151,24 +123,24 @@ pub fn ice_msg(msg: &str) -> ~str {
             \nWe would appreciate a bug report: {}", msg, BUG_REPORT_URL)
 }
 
-pub fn mk_span_handler(handler: @mut handler, cm: @codemap::CodeMap)
-                    -> @mut span_handler {
-    @mut CodemapT {
+pub fn mk_span_handler(handler: @mut Handler, cm: @codemap::CodeMap)
+                    -> @mut SpanHandler {
+    @mut SpanHandler {
         handler: handler,
         cm: cm,
-    } as @mut span_handler
+    }
 }
 
-pub fn mk_handler(emitter: Option<@Emitter>) -> @mut handler {
+pub fn mk_handler(emitter: Option<@Emitter>) -> @mut Handler {
     let emit: @Emitter = match emitter {
         Some(e) => e,
         None => @DefaultEmitter as @Emitter
     };
 
-    @mut HandlerT {
+    @mut Handler {
         err_count: 0,
         emit: emit,
-    } as @mut handler
+    }
 }
 
 #[deriving(Eq)]
@@ -356,7 +328,7 @@ fn print_macro_backtrace(cm: @codemap::CodeMap, sp: Span) {
 }
 
 pub fn expect<T:Clone>(
-              diag: @mut span_handler,
+              diag: @mut SpanHandler,
               opt: Option<T>,
               msg: || -> ~str)
               -> T {
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index ccbc533fbcc..7c2dad34002 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -12,7 +12,6 @@ use ast;
 use ast::Name;
 use codemap;
 use codemap::{CodeMap, Span, ExpnInfo};
-use diagnostic::span_handler;
 use ext;
 use ext::expand;
 use parse;
diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs
index 58a114a2de0..fc7d3d2b40c 100644
--- a/src/libsyntax/ext/tt/transcribe.rs
+++ b/src/libsyntax/ext/tt/transcribe.rs
@@ -11,7 +11,7 @@
 use ast;
 use ast::{token_tree, tt_delim, tt_tok, tt_seq, tt_nonterminal,Ident};
 use codemap::{Span, dummy_sp};
-use diagnostic::span_handler;
+use diagnostic::SpanHandler;
 use ext::tt::macro_parser::{named_match, matched_seq, matched_nonterminal};
 use parse::token::{EOF, INTERPOLATED, IDENT, Token, nt_ident};
 use parse::token::{ident_to_str};
@@ -30,7 +30,7 @@ struct TtFrame {
 }
 
 pub struct TtReader {
-    sp_diag: @mut span_handler,
+    sp_diag: @mut SpanHandler,
     // the unzipped tree:
     stack: @mut TtFrame,
     /* for MBE-style macro transcription */
@@ -45,7 +45,7 @@ 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 span_handler,
+pub fn new_tt_reader(sp_diag: @mut SpanHandler,
                      interp: Option<HashMap<Ident,@named_match>>,
                      src: ~[ast::token_tree])
                   -> @mut TtReader {
diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs
index 0704bf913d7..b1390253d19 100644
--- a/src/libsyntax/parse/comments.rs
+++ b/src/libsyntax/parse/comments.rs
@@ -342,7 +342,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::span_handler,
+                                    @mut 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 d48c1d9d8d7..8b7ef6d9cf8 100644
--- a/src/libsyntax/parse/lexer.rs
+++ b/src/libsyntax/parse/lexer.rs
@@ -11,7 +11,7 @@
 use ast;
 use codemap::{BytePos, CharPos, CodeMap, Pos, Span};
 use codemap;
-use diagnostic::span_handler;
+use diagnostic::SpanHandler;
 use ext::tt::transcribe::{tt_next_token};
 use ext::tt::transcribe::{dup_tt_reader};
 use parse::token;
@@ -29,7 +29,7 @@ pub trait reader {
     fn is_eof(@mut self) -> bool;
     fn next_token(@mut self) -> TokenAndSpan;
     fn fatal(@mut self, ~str) -> !;
-    fn span_diag(@mut self) -> @mut span_handler;
+    fn span_diag(@mut self) -> @mut SpanHandler;
     fn peek(@mut self) -> TokenAndSpan;
     fn dup(@mut self) -> @mut reader;
 }
@@ -41,7 +41,7 @@ pub struct TokenAndSpan {
 }
 
 pub struct StringReader {
-    span_diagnostic: @mut span_handler,
+    span_diagnostic: @mut SpanHandler,
     src: @str,
     // The absolute offset within the codemap of the next character to read
     pos: BytePos,
@@ -57,7 +57,7 @@ pub struct StringReader {
     peek_span: Span
 }
 
-pub fn new_string_reader(span_diagnostic: @mut span_handler,
+pub fn new_string_reader(span_diagnostic: @mut SpanHandler,
                          filemap: @codemap::FileMap)
                       -> @mut StringReader {
     let r = new_low_level_string_reader(span_diagnostic, filemap);
@@ -66,7 +66,7 @@ pub fn new_string_reader(span_diagnostic: @mut span_handler,
 }
 
 /* For comments.rs, which hackily pokes into 'pos' and 'curr' */
-pub fn new_low_level_string_reader(span_diagnostic: @mut span_handler,
+pub fn new_low_level_string_reader(span_diagnostic: @mut SpanHandler,
                                    filemap: @codemap::FileMap)
                                 -> @mut StringReader {
     // Force the initial reader bump to start on a fresh line
@@ -118,7 +118,7 @@ impl reader for StringReader {
     fn fatal(@mut self, m: ~str) -> ! {
         self.span_diagnostic.span_fatal(self.peek_span, m)
     }
-    fn span_diag(@mut self) -> @mut span_handler { self.span_diagnostic }
+    fn span_diag(@mut self) -> @mut SpanHandler { self.span_diagnostic }
     fn peek(@mut self) -> TokenAndSpan {
         // XXX(pcwalton): Bad copy!
         TokenAndSpan {
@@ -139,7 +139,7 @@ impl reader for TtReader {
     fn fatal(@mut self, m: ~str) -> ! {
         self.sp_diag.span_fatal(self.cur_span, m);
     }
-    fn span_diag(@mut self) -> @mut span_handler { self.sp_diag }
+    fn span_diag(@mut self) -> @mut SpanHandler { self.sp_diag }
     fn peek(@mut self) -> TokenAndSpan {
         TokenAndSpan {
             tok: self.cur_tok.clone(),
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index 73240a9effd..8aedc146240 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -14,7 +14,7 @@
 use ast;
 use codemap::{Span, CodeMap, FileMap, FileSubstr};
 use codemap;
-use diagnostic::{span_handler, mk_span_handler, mk_handler, Emitter};
+use diagnostic::{SpanHandler, mk_span_handler, mk_handler, Emitter};
 use parse::attr::parser_attr;
 use parse::lexer::reader;
 use parse::parser::Parser;
@@ -41,7 +41,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 span_handler, // better be the same as the one in the reader!
+    span_diagnostic: @mut SpanHandler, // better be the same as the one in the reader!
     /// Used to determine and report recursive mod inclusions
     included_mod_stack: ~[Path],
 }
@@ -55,7 +55,7 @@ pub fn new_parse_sess(demitter: Option<@Emitter>) -> @mut ParseSess {
     }
 }
 
-pub fn new_parse_sess_special_handler(sh: @mut span_handler,
+pub fn new_parse_sess_special_handler(sh: @mut SpanHandler,
                                       cm: @codemap::CodeMap)
                                    -> @mut ParseSess {
     @mut ParseSess {
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 7cea2ed3f9c..fa0d2d4765b 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::span_handler,
+                   span_diagnostic: @mut diagnostic::SpanHandler,
                    crate: &ast::Crate,
                    filename: @str,
                    input: @mut io::Reader,