X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_lint%2Fsrc%2Flate.rs;h=e019b621aa359a378069ce079a0623471446188f;hb=ff14cac621ce63d848abf615e45acd86fec32f50;hp=3821a393efb8b851c959a35f94135b4cf04421fa;hpb=853cfd462f629152f808c549c37e09d590a7921c;p=rust.git diff --git a/compiler/rustc_lint/src/late.rs b/compiler/rustc_lint/src/late.rs index 3821a393efb..e019b621aa3 100644 --- a/compiler/rustc_lint/src/late.rs +++ b/compiler/rustc_lint/src/late.rs @@ -142,8 +142,8 @@ fn visit_item(&mut self, it: &'tcx hir::Item<'tcx>) { self.context.generics = it.kind.generics(); let old_cached_typeck_results = self.context.cached_typeck_results.take(); let old_enclosing_body = self.context.enclosing_body.take(); - self.with_lint_attrs(it.hir_id, &it.attrs, |cx| { - cx.with_param_env(it.hir_id, |cx| { + self.with_lint_attrs(it.hir_id(), &it.attrs, |cx| { + cx.with_param_env(it.hir_id(), |cx| { lint_callback!(cx, check_item, it); hir_visit::walk_item(cx, it); lint_callback!(cx, check_item_post, it); @@ -155,8 +155,8 @@ fn visit_item(&mut self, it: &'tcx hir::Item<'tcx>) { } fn visit_foreign_item(&mut self, it: &'tcx hir::ForeignItem<'tcx>) { - self.with_lint_attrs(it.hir_id, &it.attrs, |cx| { - cx.with_param_env(it.hir_id, |cx| { + self.with_lint_attrs(it.hir_id(), &it.attrs, |cx| { + cx.with_param_env(it.hir_id(), |cx| { lint_callback!(cx, check_foreign_item, it); hir_visit::walk_foreign_item(cx, it); lint_callback!(cx, check_foreign_item_post, it); @@ -178,7 +178,7 @@ fn visit_expr(&mut self, e: &'tcx hir::Expr<'tcx>) { } fn visit_stmt(&mut self, s: &'tcx hir::Stmt<'tcx>) { - let get_item = |id: hir::ItemId| self.context.tcx.hir().item(id.id); + let get_item = |id: hir::ItemId| self.context.tcx.hir().item(id); let attrs = &s.kind.attrs(get_item); // See `EarlyContextAndPass::visit_stmt` for an explanation // of why we call `walk_stmt` outside of `with_lint_attrs` @@ -301,8 +301,8 @@ fn visit_poly_trait_ref( fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem<'tcx>) { let generics = self.context.generics.take(); self.context.generics = Some(&trait_item.generics); - self.with_lint_attrs(trait_item.hir_id, &trait_item.attrs, |cx| { - cx.with_param_env(trait_item.hir_id, |cx| { + self.with_lint_attrs(trait_item.hir_id(), &trait_item.attrs, |cx| { + cx.with_param_env(trait_item.hir_id(), |cx| { lint_callback!(cx, check_trait_item, trait_item); hir_visit::walk_trait_item(cx, trait_item); lint_callback!(cx, check_trait_item_post, trait_item); @@ -314,8 +314,8 @@ fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem<'tcx>) { fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem<'tcx>) { let generics = self.context.generics.take(); self.context.generics = Some(&impl_item.generics); - self.with_lint_attrs(impl_item.hir_id, &impl_item.attrs, |cx| { - cx.with_param_env(impl_item.hir_id, |cx| { + self.with_lint_attrs(impl_item.hir_id(), &impl_item.attrs, |cx| { + cx.with_param_env(impl_item.hir_id(), |cx| { lint_callback!(cx, check_impl_item, impl_item); hir_visit::walk_impl_item(cx, impl_item); lint_callback!(cx, check_impl_item_post, impl_item); @@ -496,7 +496,7 @@ pub fn check_crate<'tcx, T: LateLintPass<'tcx>>( tcx.sess.time("module_lints", || { // Run per-module lints par_iter(&tcx.hir().krate().modules).for_each(|(&module, _)| { - tcx.ensure().lint_mod(tcx.hir().local_def_id(module)); + tcx.ensure().lint_mod(module); }); }); },