diff options
author | mark <markm@cs.wisc.edu> | 2018-07-13 23:40:29 -0500 |
---|---|---|
committer | mark <markm@cs.wisc.edu> | 2018-07-23 21:55:51 -0500 |
commit | 6cb09ccf9f524590d7cc9f8c97732742446ae2b2 (patch) | |
tree | be8a3be455c2faa6f3923ce43132823dacfb51dd | |
parent | b206aedb1bbdd45578668afd7f5589b1b812fd22 (diff) | |
download | rust-6cb09ccf9f524590d7cc9f8c97732742446ae2b2.tar.gz |
dump lints _after_ parsing macros
-rw-r--r-- | src/librustc_driver/driver.rs | 16 | ||||
-rw-r--r-- | src/libsyntax/parse/mod.rs | 6 |
2 files changed, 12 insertions, 10 deletions
diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index 3e14ec6f8d4..91392ab013d 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -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)?; diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 5dbf569766e..d029509f0c1 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -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, }); + }); } } |