diff options
| author | bors <bors@rust-lang.org> | 2019-11-04 09:00:39 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-11-04 09:00:39 +0000 |
| commit | ab6e47851b51a413db5d721f25d714653e7549fd (patch) | |
| tree | 31b2ec020f7c4c139561fdb05b6357574f91d5f7 /src/librustc_interface/passes.rs | |
| parent | cba93685377bc74a2fde1eb8e7a086039b038e94 (diff) | |
| parent | c68df7c503676a1f63c0fcc2a7f10597fb93c375 (diff) | |
| download | rust-ab6e47851b51a413db5d721f25d714653e7549fd.tar.gz rust-ab6e47851b51a413db5d721f25d714653e7549fd.zip | |
Auto merge of #65835 - Mark-Simulacrum:lockless-lintbuffer, r=nikomatsakis
Remove LintBuffer from Session This moves the `LintBuffer` from `Session` into the `Resolver`, where it is used until lowering is done and then consumed by early lint passes. This also happily removes the failure mode of buffering lints too late where it would have previously lead to ICEs; it is statically no longer possible to do so. I suspect that with a bit more work a similar move could be done for the lint buffer inside `ParseSess`, but this PR doesn't touch it (in part to keep itself small). The last commit is the "interesting" commit -- the ones before it don't work (though they compile) as they sort of prepare the various crates for the lint buffer to be passed in rather than accessed through Session.
Diffstat (limited to 'src/librustc_interface/passes.rs')
| -rw-r--r-- | src/librustc_interface/passes.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs index b8593bd9199..52332744d1a 100644 --- a/src/librustc_interface/passes.rs +++ b/src/librustc_interface/passes.rs @@ -267,6 +267,7 @@ fn configure_and_expand_inner<'a>( lint_store, &krate, true, + None, rustc_lint::BuiltinCombinedPreExpansionLintPass::new()); }); @@ -293,6 +294,8 @@ fn configure_and_expand_inner<'a>( krate }); + util::check_attr_crate_type(&krate.attrs, &mut resolver.lint_buffer()); + syntax_ext::plugin_macro_defs::inject( &mut krate, &mut resolver, plugin_info.syntax_exts, sess.edition() ); @@ -366,7 +369,7 @@ fn configure_and_expand_inner<'a>( for span in missing_fragment_specifiers { let lint = lint::builtin::MISSING_FRAGMENT_SPECIFIER; let msg = "missing fragment specifier"; - sess.buffer_lint(lint, ast::CRATE_NODE_ID, span, msg); + resolver.lint_buffer().buffer_lint(lint, ast::CRATE_NODE_ID, span, msg); } if cfg!(windows) { env::set_var("PATH", &old_path); @@ -395,7 +398,7 @@ fn configure_and_expand_inner<'a>( } let has_proc_macro_decls = time(sess, "AST validation", || { - ast_validation::check_crate(sess, &krate) + ast_validation::check_crate(sess, &krate, &mut resolver.lint_buffer()) }); @@ -464,7 +467,7 @@ fn configure_and_expand_inner<'a>( 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); + resolver.lint_buffer().buffer_lint(lint, id, span, &msg); } }); @@ -496,6 +499,7 @@ pub fn lower_to_hir( lint_store, &krate, false, + Some(std::mem::take(resolver.lint_buffer())), rustc_lint::BuiltinCombinedEarlyLintPass::new(), ) }); |
