move error handling from libsyntax/diagnostics.rs to libsyntax/errors/*

Also split out emitters into their own module.
This commit is contained in:
Nick Cameron
2015-12-14 11:17:55 +13:00
parent 073b0f9b85
commit 6309b0f5bb
33 changed files with 207 additions and 1109 deletions

View File

@@ -720,7 +720,7 @@ impl<'a> ExtCtxt<'a> {
self.parse_sess.span_diagnostic.fileline_help(sp, msg);
}
pub fn bug(&self, msg: &str) -> ! {
self.parse_sess.span_diagnostic.handler().bug(msg);
self.parse_sess.span_diagnostic.bug(msg);
}
pub fn trace_macros(&self) -> bool {
self.ecfg.trace_mac

View File

@@ -1301,7 +1301,7 @@ pub fn expand_crate(mut cx: ExtCtxt,
let mut ret = expander.fold_crate(c);
ret.exported_macros = expander.cx.exported_macros.clone();
cx.parse_sess.span_diagnostic.handler().abort_if_errors();
cx.parse_sess.span_diagnostic.abort_if_errors();
ret
};
return (ret, cx.syntax_env.names);

View File

@@ -12,7 +12,7 @@ use self::LockstepIterSize::*;
use ast;
use ast::{TokenTree, Ident, Name};
use codemap::{Span, DUMMY_SP};
use diagnostic::SpanHandler;
use errors::Handler;
use ext::tt::macro_parser::{NamedMatch, MatchedSeq, MatchedNonterminal};
use parse::token::{Eof, DocComment, Interpolated, MatchNt, SubstNt};
use parse::token::{Token, NtIdent, SpecialMacroVar};
@@ -34,7 +34,7 @@ struct TtFrame {
#[derive(Clone)]
pub struct TtReader<'a> {
pub sp_diag: &'a SpanHandler,
pub sp_diag: &'a Handler,
/// the unzipped tree:
stack: Vec<TtFrame>,
/* for MBE-style macro transcription */
@@ -55,7 +55,7 @@ pub struct TtReader<'a> {
/// This can do Macro-By-Example transcription. On the other hand, if
/// `src` contains no `TokenTree::Sequence`s, `MatchNt`s or `SubstNt`s, `interp` can
/// (and should) be None.
pub fn new_tt_reader<'a>(sp_diag: &'a SpanHandler,
pub fn new_tt_reader<'a>(sp_diag: &'a Handler,
interp: Option<HashMap<Name, Rc<NamedMatch>>>,
imported_from: Option<Ident>,
src: Vec<ast::TokenTree>)
@@ -69,7 +69,7 @@ pub fn new_tt_reader<'a>(sp_diag: &'a SpanHandler,
/// This can do Macro-By-Example transcription. On the other hand, if
/// `src` contains no `TokenTree::Sequence`s, `MatchNt`s or `SubstNt`s, `interp` can
/// (and should) be None.
pub fn new_tt_reader_with_doc_flag<'a>(sp_diag: &'a SpanHandler,
pub fn new_tt_reader_with_doc_flag<'a>(sp_diag: &'a Handler,
interp: Option<HashMap<Name, Rc<NamedMatch>>>,
imported_from: Option<Ident>,
src: Vec<ast::TokenTree>,