Avoid aborting after expansion from BuildReducedGraphVisitor errors.
This commit is contained in:
@@ -708,6 +708,7 @@ pub struct ExtCtxt<'a> {
|
||||
pub ecfg: expand::ExpansionConfig<'a>,
|
||||
pub crate_root: Option<&'static str>,
|
||||
pub resolver: &'a mut Resolver,
|
||||
pub resolve_err_count: usize,
|
||||
pub current_expansion: ExpansionData,
|
||||
}
|
||||
|
||||
@@ -722,6 +723,7 @@ impl<'a> ExtCtxt<'a> {
|
||||
ecfg: ecfg,
|
||||
crate_root: None,
|
||||
resolver: resolver,
|
||||
resolve_err_count: 0,
|
||||
current_expansion: ExpansionData {
|
||||
mark: Mark::root(),
|
||||
depth: 0,
|
||||
|
||||
@@ -200,7 +200,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
if self.cx.parse_sess.span_diagnostic.err_count() > err_count {
|
||||
if self.cx.parse_sess.span_diagnostic.err_count() - self.cx.resolve_err_count > err_count {
|
||||
self.cx.parse_sess.span_diagnostic.abort_if_errors();
|
||||
}
|
||||
|
||||
@@ -271,8 +271,10 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
|
||||
self.cx.cfg = crate_config;
|
||||
|
||||
if self.monotonic {
|
||||
let err_count = self.cx.parse_sess.span_diagnostic.err_count();
|
||||
let mark = self.cx.current_expansion.mark;
|
||||
self.cx.resolver.visit_expansion(mark, &result.0);
|
||||
self.cx.resolve_err_count += self.cx.parse_sess.span_diagnostic.err_count() - err_count;
|
||||
}
|
||||
|
||||
result
|
||||
|
||||
Reference in New Issue
Block a user