diff options
| author | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2016-06-25 22:27:27 +0000 |
|---|---|---|
| committer | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2016-06-25 22:35:09 +0000 |
| commit | d3ae56d755f912471e4c36982a069317842fa495 (patch) | |
| tree | b2056ff0adb5634e0793e94b98af46cd19709390 /src/libsyntax/ext/tt | |
| parent | 4e2e31c11837f244e5039165b777ddedde5dc44d (diff) | |
| parent | bc1400600be083cfb39ffdc6f6b32153e585cd3c (diff) | |
| download | rust-d3ae56d755f912471e4c36982a069317842fa495.tar.gz rust-d3ae56d755f912471e4c36982a069317842fa495.zip | |
Rollup merge of #34403 - jonathandturner:move_liberror, r=alexcrichton
This PR refactors the 'errors' part of libsyntax into its own crate (librustc_errors). This is the first part of a few refactorings to simplify error reporting and potentially support more output formats (like a standardized JSON output and possibly an --explain mode that can work with the user's code), though this PR stands on its own and doesn't assume further changes. As part of separating out the errors crate, I have also refactored the code position portion of codemap into its own crate (libsyntax_pos). While it's helpful to have the common code positions in a separate crate for the new errors crate, this may also enable further simplifications in the future.
Diffstat (limited to 'src/libsyntax/ext/tt')
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 12 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/transcribe.rs | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index ca5eb8f8003..2230da10552 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -80,8 +80,8 @@ use self::TokenTreeOrTokenTreeVec::*; use ast; use ast::{TokenTree, Name, Ident}; -use codemap::{BytePos, mk_sp, Span, Spanned}; -use codemap; +use syntax_pos::{self, BytePos, mk_sp, Span}; +use codemap::Spanned; use errors::FatalError; use parse::lexer::*; //resolve bug? use parse::ParseSess; @@ -196,7 +196,7 @@ pub fn initial_matcher_pos(ms: Rc<Vec<TokenTree>>, sep: Option<Token>, lo: ByteP /// token tree it was derived from. pub enum NamedMatch { - MatchedSeq(Vec<Rc<NamedMatch>>, codemap::Span), + MatchedSeq(Vec<Rc<NamedMatch>>, syntax_pos::Span), MatchedNonterminal(Nonterminal) } @@ -204,7 +204,7 @@ pub fn nameize(p_s: &ParseSess, ms: &[TokenTree], res: &[Rc<NamedMatch>]) -> ParseResult<HashMap<Name, Rc<NamedMatch>>> { fn n_rec(p_s: &ParseSess, m: &TokenTree, res: &[Rc<NamedMatch>], ret_val: &mut HashMap<Name, Rc<NamedMatch>>, idx: &mut usize) - -> Result<(), (codemap::Span, String)> { + -> Result<(), (syntax_pos::Span, String)> { match *m { TokenTree::Sequence(_, ref seq) => { for next_m in &seq.tts { @@ -251,9 +251,9 @@ pub fn nameize(p_s: &ParseSess, ms: &[TokenTree], res: &[Rc<NamedMatch>]) pub enum ParseResult<T> { Success(T), /// Arm failed to match - Failure(codemap::Span, String), + Failure(syntax_pos::Span, String), /// Fatal error (malformed macro?). Abort compilation. - Error(codemap::Span, String) + Error(syntax_pos::Span, String) } pub type NamedParseResult = ParseResult<HashMap<Name, Rc<NamedMatch>>>; diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index fe98394c3e4..850fbb5addf 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -9,7 +9,7 @@ // except according to those terms. use ast::{self, TokenTree}; -use codemap::{Span, DUMMY_SP}; +use syntax_pos::{Span, DUMMY_SP}; use ext::base::{DummyResult, ExtCtxt, MacResult, SyntaxExtension}; use ext::base::{NormalTT, TTMacroExpander}; use ext::tt::macro_parser::{Success, Error, Failure}; diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index 6b3b5ce9de9..8b5ecd10fcb 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -11,7 +11,7 @@ use self::LockstepIterSize::*; use ast; use ast::{TokenTree, Ident, Name}; -use codemap::{Span, DUMMY_SP}; +use syntax_pos::{Span, DUMMY_SP}; use errors::{Handler, DiagnosticBuilder}; use ext::tt::macro_parser::{NamedMatch, MatchedSeq, MatchedNonterminal}; use parse::token::{DocComment, MatchNt, SubstNt}; |
