Move lint expectation checking into a separate query (RFC 2383)

This commit is contained in:
xFrednet 2022-03-29 00:10:45 +02:00
parent 7f03681cd9
commit 2c5e85249f
No known key found for this signature in database
GPG key ID: FCDCBF29AF64D601
8 changed files with 68 additions and 13 deletions

View file

@ -157,6 +157,25 @@ rustc_queries! {
desc { "running analysis passes on this crate" }
}
/// This query checks the fulfillment of collected lint expectations.
/// All lint emitting queries have to be done before this is executed
/// to ensure that all expectations can be fulfilled.
///
/// This is an extra query to enable other drivers (like rustdoc) to
/// only execute a small subset of the [`analysis`] query, while allowing
/// lints to be expected. In rustc, this query will be executed as part of
/// the [`analysis`] query and doesn't have to be called a second time.
///
/// Tools can additionally pass in a tool filter. That will restrict the
/// expectations to only trigger for lints starting with the listed tool
/// name. This is useful for cases were not all linting code from rustc
/// was called. With the default `none` all registered lints will also
/// be checked for expectation fulfillment.
query check_expectations(key: Option<Symbol>) -> () {
eval_always
desc { "checking lint expectations (RFC 2383)" }
}
/// Maps from the `DefId` of an item (trait/struct/enum/fn) to its
/// associated generics.
query generics_of(key: DefId) -> ty::Generics {