dump lints _after_ parsing macros

This commit is contained in:
mark 2018-07-13 23:40:29 -05:00
parent b206aedb1b
commit 6cb09ccf9f
2 changed files with 12 additions and 10 deletions

View File

@ -697,13 +697,6 @@ pub fn phase_1_parse_input<'a>(
hir_stats::print_ast_stats(&krate, "PRE EXPANSION AST STATS");
}
// Add all buffered lints from the `ParseSess` to the `Session`.
let mut parse_sess_buffered = sess.parse_sess.buffered_lints.borrow_mut();
for BufferedEarlyLint{id, span, msg, lint_id} in parse_sess_buffered.drain(..) {
let lint = lint::Lint::from_parser_lint_id(lint_id);
sess.buffer_lint(lint, id, span, &msg);
}
Ok(krate)
}
@ -1074,6 +1067,15 @@ where
)
});
// Add all buffered lints from the `ParseSess` to the `Session`.
sess.parse_sess.buffered_lints.with_lock(|buffered_lints| {
info!("{} parse sess buffered_lints", buffered_lints.len());
for BufferedEarlyLint{id, span, msg, lint_id} in buffered_lints.drain(..) {
let lint = lint::Lint::from_parser_lint_id(lint_id);
sess.buffer_lint(lint, id, span, &msg);
}
});
// Done with macro expansion!
after_expand(&krate)?;

View File

@ -96,14 +96,14 @@ impl ParseSess {
id: NodeId,
msg: &str,
) {
self.buffered_lints
.borrow_mut()
.push(BufferedEarlyLint{
self.buffered_lints.with_lock(|buffered_lints| {
buffered_lints.push(BufferedEarlyLint{
span: span.into(),
id,
msg: msg.into(),
lint_id,
});
});
}
}