1
Fork 0

Rollup merge of #122813 - nnethercote:nicer-quals, r=compiler-errors

Qualifier tweaking

Adding and removing qualifiers in some cases that make things nicer. Details in individual commits.

r? `@compiler-errors`
This commit is contained in:
Matthias Krüger 2024-04-17 05:44:52 +02:00 committed by GitHub
commit 45940fe6d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
62 changed files with 346 additions and 399 deletions

View file

@ -20,6 +20,7 @@ use rustc_data_structures::sync::{join, Lrc};
use rustc_hir as hir;
use rustc_hir::def_id::{LocalDefId, LocalModDefId};
use rustc_hir::intravisit as hir_visit;
use rustc_hir::HirId;
use rustc_middle::hir::nested_filter;
use rustc_middle::ty::{self, TyCtxt};
use rustc_session::lint::LintPass;
@ -53,7 +54,7 @@ impl<'tcx, T: LateLintPass<'tcx>> LateContextAndPass<'tcx, T> {
/// Merge the lints specified by any lint attributes into the
/// current lint context, call the provided function, then reset the
/// lints in effect to their previous state.
fn with_lint_attrs<F>(&mut self, id: hir::HirId, f: F)
fn with_lint_attrs<F>(&mut self, id: HirId, f: F)
where
F: FnOnce(&mut Self),
{
@ -81,7 +82,7 @@ impl<'tcx, T: LateLintPass<'tcx>> LateContextAndPass<'tcx, T> {
self.context.param_env = old_param_env;
}
fn process_mod(&mut self, m: &'tcx hir::Mod<'tcx>, n: hir::HirId) {
fn process_mod(&mut self, m: &'tcx hir::Mod<'tcx>, n: HirId) {
lint_callback!(self, check_mod, m, n);
hir_visit::walk_mod(self, m, n);
}
@ -231,7 +232,7 @@ impl<'tcx, T: LateLintPass<'tcx>> hir_visit::Visitor<'tcx> for LateContextAndPas
hir_visit::walk_inf(self, inf);
}
fn visit_mod(&mut self, m: &'tcx hir::Mod<'tcx>, _: Span, n: hir::HirId) {
fn visit_mod(&mut self, m: &'tcx hir::Mod<'tcx>, _: Span, n: HirId) {
if !self.context.only_module {
self.process_mod(m, n);
}
@ -305,7 +306,7 @@ impl<'tcx, T: LateLintPass<'tcx>> hir_visit::Visitor<'tcx> for LateContextAndPas
hir_visit::walk_lifetime(self, lt);
}
fn visit_path(&mut self, p: &hir::Path<'tcx>, id: hir::HirId) {
fn visit_path(&mut self, p: &hir::Path<'tcx>, id: HirId) {
lint_callback!(self, check_path, p, id);
hir_visit::walk_path(self, p);
}