diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2023-11-24 19:28:19 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2023-11-26 12:41:21 +0300 |
| commit | c697927f443043fb9715b9b239fa1d2440c0e53c (patch) | |
| tree | bf4639a340a229b2940d78a6ffd226c4a4f1ff1a /compiler/rustc_passes | |
| parent | 9529a5d2655f6974c2ee16e91c5db548a3daea03 (diff) | |
| download | rust-c697927f443043fb9715b9b239fa1d2440c0e53c.tar.gz rust-c697927f443043fb9715b9b239fa1d2440c0e53c.zip | |
rustc: `hir().local_def_id_to_hir_id()` -> `tcx.local_def_id_to_hir_id()` cleanup
Diffstat (limited to 'compiler/rustc_passes')
| -rw-r--r-- | compiler/rustc_passes/src/check_const.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_passes/src/dead.rs | 12 | ||||
| -rw-r--r-- | compiler/rustc_passes/src/lang_items.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_passes/src/naked_functions.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_passes/src/reachable.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_passes/src/stability.rs | 4 |
6 files changed, 12 insertions, 14 deletions
diff --git a/compiler/rustc_passes/src/check_const.rs b/compiler/rustc_passes/src/check_const.rs index 22b80a60d42..de96746e215 100644 --- a/compiler/rustc_passes/src/check_const.rs +++ b/compiler/rustc_passes/src/check_const.rs @@ -110,7 +110,7 @@ impl<'tcx> CheckConstVisitor<'tcx> { // However, we cannot allow stable `const fn`s to use unstable features without an explicit // opt-in via `rustc_allow_const_fn_unstable`. - let attrs = tcx.hir().attrs(tcx.hir().local_def_id_to_hir_id(def_id)); + let attrs = tcx.hir().attrs(tcx.local_def_id_to_hir_id(def_id)); attr::rustc_allow_const_fn_unstable(tcx.sess, attrs).any(|name| name == feature_gate) }; diff --git a/compiler/rustc_passes/src/dead.rs b/compiler/rustc_passes/src/dead.rs index b4ebc2db3d6..7d1cc81e21f 100644 --- a/compiler/rustc_passes/src/dead.rs +++ b/compiler/rustc_passes/src/dead.rs @@ -559,7 +559,7 @@ fn has_allow_dead_code_or_lang_attr( } fn has_allow_expect_dead_code(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool { - let hir_id = tcx.hir().local_def_id_to_hir_id(def_id); + let hir_id = tcx.local_def_id_to_hir_id(def_id); let lint_level = tcx.lint_level_at_node(lint::builtin::DEAD_CODE, hir_id).0; matches!(lint_level, lint::Allow | lint::Expect(_)) } @@ -805,10 +805,10 @@ impl<'tcx> DeadVisitor<'tcx> { }; let tcx = self.tcx; - let first_hir_id = tcx.hir().local_def_id_to_hir_id(first_id); + let first_hir_id = tcx.local_def_id_to_hir_id(first_id); let first_lint_level = tcx.lint_level_at_node(lint::builtin::DEAD_CODE, first_hir_id).0; assert!(dead_codes.iter().skip(1).all(|id| { - let hir_id = tcx.hir().local_def_id_to_hir_id(*id); + let hir_id = tcx.local_def_id_to_hir_id(*id); let level = tcx.lint_level_at_node(lint::builtin::DEAD_CODE, hir_id).0; level == first_lint_level })); @@ -969,7 +969,7 @@ fn check_mod_deathness(tcx: TyCtxt<'_>, module: LocalModDefId) { let def_id = item.id.owner_id.def_id; if !visitor.is_live_code(def_id) { let name = tcx.item_name(def_id.to_def_id()); - let hir_id = tcx.hir().local_def_id_to_hir_id(def_id); + let hir_id = tcx.local_def_id_to_hir_id(def_id); let level = tcx.lint_level_at_node(lint::builtin::DEAD_CODE, hir_id).0; dead_items.push(DeadItem { def_id, name, level }) @@ -997,7 +997,7 @@ fn check_mod_deathness(tcx: TyCtxt<'_>, module: LocalModDefId) { let def_id = variant.def_id.expect_local(); if !live_symbols.contains(&def_id) { // Record to group diagnostics. - let hir_id = tcx.hir().local_def_id_to_hir_id(def_id); + let hir_id = tcx.local_def_id_to_hir_id(def_id); let level = tcx.lint_level_at_node(lint::builtin::DEAD_CODE, hir_id).0; dead_variants.push(DeadItem { def_id, name: variant.name, level }); continue; @@ -1009,7 +1009,7 @@ fn check_mod_deathness(tcx: TyCtxt<'_>, module: LocalModDefId) { .iter() .filter_map(|field| { let def_id = field.did.expect_local(); - let hir_id = tcx.hir().local_def_id_to_hir_id(def_id); + let hir_id = tcx.local_def_id_to_hir_id(def_id); if let ShouldWarnAboutField::Yes(is_pos) = visitor.should_warn_about_field(field) { diff --git a/compiler/rustc_passes/src/lang_items.rs b/compiler/rustc_passes/src/lang_items.rs index f78157f89ae..23baf14aea1 100644 --- a/compiler/rustc_passes/src/lang_items.rs +++ b/compiler/rustc_passes/src/lang_items.rs @@ -42,7 +42,7 @@ impl<'tcx> LanguageItemCollector<'tcx> { } fn check_for_lang(&mut self, actual_target: Target, def_id: LocalDefId) { - let attrs = self.tcx.hir().attrs(self.tcx.hir().local_def_id_to_hir_id(def_id)); + let attrs = self.tcx.hir().attrs(self.tcx.local_def_id_to_hir_id(def_id)); if let Some((name, span)) = extract(attrs) { match LangItem::from_name(name) { // Known lang item with attribute on correct target. diff --git a/compiler/rustc_passes/src/naked_functions.rs b/compiler/rustc_passes/src/naked_functions.rs index 54f296da5c5..bd73fa78442 100644 --- a/compiler/rustc_passes/src/naked_functions.rs +++ b/compiler/rustc_passes/src/naked_functions.rs @@ -68,7 +68,7 @@ fn check_inline(tcx: TyCtxt<'_>, def_id: LocalDefId) { /// Checks that function uses non-Rust ABI. fn check_abi(tcx: TyCtxt<'_>, def_id: LocalDefId, abi: Abi) { if abi == Abi::Rust { - let hir_id = tcx.hir().local_def_id_to_hir_id(def_id); + let hir_id = tcx.local_def_id_to_hir_id(def_id); let span = tcx.def_span(def_id); tcx.emit_spanned_lint( UNDEFINED_NAKED_FUNCTION_ABI, diff --git a/compiler/rustc_passes/src/reachable.rs b/compiler/rustc_passes/src/reachable.rs index 650bb97c4d1..f89c1b0e47c 100644 --- a/compiler/rustc_passes/src/reachable.rs +++ b/compiler/rustc_passes/src/reachable.rs @@ -260,9 +260,7 @@ impl<'tcx> ReachableContext<'tcx> { _ => { bug!( "found unexpected node kind in worklist: {} ({:?})", - self.tcx - .hir() - .node_to_string(self.tcx.hir().local_def_id_to_hir_id(search_item)), + self.tcx.hir().node_to_string(self.tcx.local_def_id_to_hir_id(search_item)), node, ); } diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs index fd7cf1ac11e..26bd52f55d4 100644 --- a/compiler/rustc_passes/src/stability.rs +++ b/compiler/rustc_passes/src/stability.rs @@ -111,7 +111,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> { ) where F: FnOnce(&mut Self), { - let attrs = self.tcx.hir().attrs(self.tcx.hir().local_def_id_to_hir_id(def_id)); + let attrs = self.tcx.hir().attrs(self.tcx.local_def_id_to_hir_id(def_id)); debug!("annotate(id = {:?}, attrs = {:?})", def_id, attrs); let depr = attr::find_deprecation(self.tcx.sess, self.tcx.features(), attrs); @@ -120,7 +120,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> { is_deprecated = true; if matches!(kind, AnnotationKind::Prohibited | AnnotationKind::DeprecationProhibited) { - let hir_id = self.tcx.hir().local_def_id_to_hir_id(def_id); + let hir_id = self.tcx.local_def_id_to_hir_id(def_id); self.tcx.emit_spanned_lint( USELESS_DEPRECATED, hir_id, |
