1
Fork 0

Rollup merge of #108806 - cjgillot:query-lints, r=davidtwco

Querify register_tools and post-expansion early lints

The 2 extra queries correspond to code that happen before and after macro expansion, and don't need the resolver to exist.
This commit is contained in:
Matthias Krüger 2023-03-11 15:43:15 +01:00 committed by GitHub
commit df50001c7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 74 additions and 40 deletions

View file

@ -8,7 +8,7 @@ extern crate rustc_macros;
pub use self::Level::*;
use rustc_ast::node_id::NodeId;
use rustc_ast::{AttrId, Attribute};
use rustc_data_structures::fx::FxIndexMap;
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey};
use rustc_error_messages::{DiagnosticMessage, MultiSpan};
use rustc_hir::HashStableContext;
@ -533,6 +533,7 @@ pub enum BuiltinLintDiagnostics {
/// Lints that are buffered up early on in the `Session` before the
/// `LintLevels` is calculated.
#[derive(Debug)]
pub struct BufferedEarlyLint {
/// The span of code that we are linting on.
pub span: MultiSpan,
@ -551,7 +552,7 @@ pub struct BufferedEarlyLint {
pub diagnostic: BuiltinLintDiagnostics,
}
#[derive(Default)]
#[derive(Default, Debug)]
pub struct LintBuffer {
pub map: FxIndexMap<NodeId, Vec<BufferedEarlyLint>>,
}
@ -601,6 +602,8 @@ impl LintBuffer {
}
}
pub type RegisteredTools = FxIndexSet<Ident>;
/// Declares a static item of type `&'static Lint`.
///
/// See <https://rustc-dev-guide.rust-lang.org/diagnostics.html> for