Skip to content

Commit 6cb09cc

Browse files
committed
dump lints _after_ parsing macros
1 parent b206aed commit 6cb09cc

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

src/librustc_driver/driver.rs

+9-7
Original file line numberDiff line numberDiff line change
@@ -697,13 +697,6 @@ pub fn phase_1_parse_input<'a>(
697697
hir_stats::print_ast_stats(&krate, "PRE EXPANSION AST STATS");
698698
}
699699

700-
// Add all buffered lints from the `ParseSess` to the `Session`.
701-
let mut parse_sess_buffered = sess.parse_sess.buffered_lints.borrow_mut();
702-
for BufferedEarlyLint{id, span, msg, lint_id} in parse_sess_buffered.drain(..) {
703-
let lint = lint::Lint::from_parser_lint_id(lint_id);
704-
sess.buffer_lint(lint, id, span, &msg);
705-
}
706-
707700
Ok(krate)
708701
}
709702

@@ -1074,6 +1067,15 @@ where
10741067
)
10751068
});
10761069

1070+
// Add all buffered lints from the `ParseSess` to the `Session`.
1071+
sess.parse_sess.buffered_lints.with_lock(|buffered_lints| {
1072+
info!("{} parse sess buffered_lints", buffered_lints.len());
1073+
for BufferedEarlyLint{id, span, msg, lint_id} in buffered_lints.drain(..) {
1074+
let lint = lint::Lint::from_parser_lint_id(lint_id);
1075+
sess.buffer_lint(lint, id, span, &msg);
1076+
}
1077+
});
1078+
10771079
// Done with macro expansion!
10781080

10791081
after_expand(&krate)?;

src/libsyntax/parse/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,14 @@ impl ParseSess {
9696
id: NodeId,
9797
msg: &str,
9898
) {
99-
self.buffered_lints
100-
.borrow_mut()
101-
.push(BufferedEarlyLint{
99+
self.buffered_lints.with_lock(|buffered_lints| {
100+
buffered_lints.push(BufferedEarlyLint{
102101
span: span.into(),
103102
id,
104103
msg: msg.into(),
105104
lint_id,
106105
});
106+
});
107107
}
108108
}
109109

0 commit comments

Comments
 (0)