diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 1041ad01866..4033c2b2849 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -56,7 +56,7 @@ mod unused; use rustc_ast::ast; use rustc_hir as hir; -use rustc_hir::def_id::DefId; +use rustc_hir::def_id::LocalDefId; use rustc_middle::ty::query::Providers; use rustc_middle::ty::TyCtxt; use rustc_session::lint::builtin::{ @@ -90,12 +90,8 @@ pub fn provide(providers: &mut Providers<'_>) { *providers = Providers { lint_mod, ..*providers }; } -fn lint_mod(tcx: TyCtxt<'_>, module_def_id: DefId) { - late::late_lint_mod( - tcx, - module_def_id.expect_local(), - BuiltinCombinedModuleLateLintPass::new(), - ); +fn lint_mod(tcx: TyCtxt<'_>, module_def_id: LocalDefId) { + late::late_lint_mod(tcx, module_def_id, BuiltinCombinedModuleLateLintPass::new()); } macro_rules! pre_expansion_lint_passes { diff --git a/src/librustc_middle/query/mod.rs b/src/librustc_middle/query/mod.rs index fbacda50b97..30c3082f231 100644 --- a/src/librustc_middle/query/mod.rs +++ b/src/librustc_middle/query/mod.rs @@ -403,8 +403,8 @@ rustc_queries! { } Other { - query lint_mod(key: DefId) -> () { - desc { |tcx| "linting {}", describe_as_module(key, tcx) } + query lint_mod(key: LocalDefId) -> () { + desc { |tcx| "linting {}", describe_as_module(key.to_def_id(), tcx) } } /// Checks the attributes in the module.