buffered lint infra -> rustc_session
This commit is contained in:
parent
82eeb8573a
commit
7dbccf5b55
17 changed files with 136 additions and 137 deletions
|
|
@ -17,6 +17,7 @@ syntax = { path = "../libsyntax" }
|
|||
rustc_builtin_macros = { path = "../librustc_builtin_macros" }
|
||||
rustc_expand = { path = "../librustc_expand" }
|
||||
rustc_parse = { path = "../librustc_parse" }
|
||||
rustc_session = { path = "../librustc_session" }
|
||||
rustc_span = { path = "../librustc_span" }
|
||||
rustc_serialize = { path = "../libserialize", package = "serialize" }
|
||||
rustc = { path = "../librustc" }
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ use rustc_span::symbol::Symbol;
|
|||
use rustc_span::FileName;
|
||||
use rustc_traits;
|
||||
use rustc_typeck as typeck;
|
||||
use syntax::early_buffered_lints::BufferedEarlyLint;
|
||||
use syntax::mut_visit::MutVisitor;
|
||||
use syntax::util::node_count::NodeCounter;
|
||||
use syntax::{self, ast, visit};
|
||||
|
|
@ -411,8 +410,8 @@ fn configure_and_expand_inner<'a>(
|
|||
// 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(..) {
|
||||
resolver.lint_buffer().buffer_lint(lint_id, id, span, &msg);
|
||||
for early_lint in buffered_lints.drain(..) {
|
||||
resolver.lint_buffer().add_early_lint(early_lint);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
use log::info;
|
||||
use rustc::lint;
|
||||
use rustc::session::config::{ErrorOutputType, Input, OutputFilenames};
|
||||
use rustc::session::CrateDisambiguator;
|
||||
use rustc::session::{self, config, early_error, filesearch, DiagnosticOutput, Session};
|
||||
use rustc::ty;
|
||||
use rustc_codegen_utils::codegen_backend::CodegenBackend;
|
||||
use rustc_data_structures::fingerprint::Fingerprint;
|
||||
|
|
@ -14,6 +11,11 @@ use rustc_data_structures::sync::{Lock, Lrc};
|
|||
use rustc_errors::registry::Registry;
|
||||
use rustc_metadata::dynamic_lib::DynamicLibrary;
|
||||
use rustc_resolve::{self, Resolver};
|
||||
use rustc_session as session;
|
||||
use rustc_session::config::{ErrorOutputType, Input, OutputFilenames};
|
||||
use rustc_session::lint::{BuiltinLintDiagnostics, LintBuffer};
|
||||
use rustc_session::CrateDisambiguator;
|
||||
use rustc_session::{config, early_error, filesearch, DiagnosticOutput, Session};
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::source_map::{FileLoader, RealFileLoader, SourceMap};
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
|
|
@ -420,7 +422,7 @@ pub(crate) fn compute_crate_disambiguator(session: &Session) -> CrateDisambiguat
|
|||
CrateDisambiguator::from(hasher.finish::<Fingerprint>())
|
||||
}
|
||||
|
||||
pub(crate) fn check_attr_crate_type(attrs: &[ast::Attribute], lint_buffer: &mut lint::LintBuffer) {
|
||||
pub(crate) fn check_attr_crate_type(attrs: &[ast::Attribute], lint_buffer: &mut LintBuffer) {
|
||||
// Unconditionally collect crate types from attributes to make them used
|
||||
for a in attrs.iter() {
|
||||
if a.check_name(sym::crate_type) {
|
||||
|
|
@ -442,7 +444,7 @@ pub(crate) fn check_attr_crate_type(attrs: &[ast::Attribute], lint_buffer: &mut
|
|||
ast::CRATE_NODE_ID,
|
||||
span,
|
||||
"invalid `crate_type` value",
|
||||
lint::builtin::BuiltinLintDiagnostics::UnknownCrateTypes(
|
||||
BuiltinLintDiagnostics::UnknownCrateTypes(
|
||||
span,
|
||||
"did you mean".to_string(),
|
||||
format!("\"{}\"", candidate),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue