Remove HirId -> LocalDefId
map from HIR.
This commit is contained in:
parent
3175d03d3b
commit
15d6325747
46 changed files with 321 additions and 382 deletions
|
@ -665,7 +665,7 @@ fn check_item_type(tcx: TyCtxt<'_>, id: hir::ItemId) {
|
|||
DefKind::GlobalAsm => {
|
||||
let it = tcx.hir().item(id);
|
||||
let hir::ItemKind::GlobalAsm(asm) = it.kind else { span_bug!(it.span, "DefKind::GlobalAsm but got {:#?}", it) };
|
||||
InlineAsmCtxt::new_global_asm(tcx).check_asm(asm, id.hir_id());
|
||||
InlineAsmCtxt::new_global_asm(tcx).check_asm(asm, id.owner_id.def_id);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ use rustc_data_structures::fx::FxHashSet;
|
|||
use rustc_hir as hir;
|
||||
use rustc_middle::ty::{self, Article, FloatTy, IntTy, Ty, TyCtxt, TypeVisitable, UintTy};
|
||||
use rustc_session::lint;
|
||||
use rustc_span::def_id::LocalDefId;
|
||||
use rustc_span::{Symbol, DUMMY_SP};
|
||||
use rustc_target::asm::{InlineAsmReg, InlineAsmRegClass, InlineAsmRegOrRegClass, InlineAsmType};
|
||||
|
||||
|
@ -253,10 +254,8 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
|
|||
Some(asm_ty)
|
||||
}
|
||||
|
||||
pub fn check_asm(&self, asm: &hir::InlineAsm<'tcx>, enclosing_id: hir::HirId) {
|
||||
let hir = self.tcx.hir();
|
||||
let enclosing_def_id = hir.local_def_id(enclosing_id).to_def_id();
|
||||
let target_features = self.tcx.asm_target_features(enclosing_def_id);
|
||||
pub fn check_asm(&self, asm: &hir::InlineAsm<'tcx>, enclosing_id: LocalDefId) {
|
||||
let target_features = self.tcx.asm_target_features(enclosing_id.to_def_id());
|
||||
let Some(asm_arch) = self.tcx.sess.asm_arch else {
|
||||
self.tcx.sess.delay_span_bug(DUMMY_SP, "target architecture does not support asm");
|
||||
return;
|
||||
|
|
|
@ -391,7 +391,7 @@ fn check_gat_where_clauses(tcx: TyCtxt<'_>, associated_items: &[hir::TraitItemRe
|
|||
gather_gat_bounds(
|
||||
tcx,
|
||||
param_env,
|
||||
item_def_id.def_id,
|
||||
item_def_id,
|
||||
sig.inputs_and_output,
|
||||
// We also assume that all of the function signature's parameter types
|
||||
// are well formed.
|
||||
|
@ -413,7 +413,7 @@ fn check_gat_where_clauses(tcx: TyCtxt<'_>, associated_items: &[hir::TraitItemRe
|
|||
gather_gat_bounds(
|
||||
tcx,
|
||||
param_env,
|
||||
item_def_id.def_id,
|
||||
item_def_id,
|
||||
tcx.explicit_item_bounds(item_def_id).to_vec(),
|
||||
&FxIndexSet::default(),
|
||||
gat_def_id.def_id,
|
||||
|
@ -563,7 +563,7 @@ fn augment_param_env<'tcx>(
|
|||
fn gather_gat_bounds<'tcx, T: TypeFoldable<'tcx>>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
item_def_id: LocalDefId,
|
||||
item_def_id: hir::OwnerId,
|
||||
to_check: T,
|
||||
wf_tys: &FxIndexSet<Ty<'tcx>>,
|
||||
gat_def_id: LocalDefId,
|
||||
|
@ -596,7 +596,7 @@ fn gather_gat_bounds<'tcx, T: TypeFoldable<'tcx>>(
|
|||
// reflected in a where clause on the GAT itself.
|
||||
for (ty, ty_idx) in &types {
|
||||
// In our example, requires that `Self: 'a`
|
||||
if ty_known_to_outlive(tcx, item_def_id, param_env, &wf_tys, *ty, *region_a) {
|
||||
if ty_known_to_outlive(tcx, item_def_id.def_id, param_env, &wf_tys, *ty, *region_a) {
|
||||
debug!(?ty_idx, ?region_a_idx);
|
||||
debug!("required clause: {ty} must outlive {region_a}");
|
||||
// Translate into the generic parameters of the GAT. In
|
||||
|
@ -634,7 +634,14 @@ fn gather_gat_bounds<'tcx, T: TypeFoldable<'tcx>>(
|
|||
if ty::ReStatic == **region_b || region_a == region_b {
|
||||
continue;
|
||||
}
|
||||
if region_known_to_outlive(tcx, item_def_id, param_env, &wf_tys, *region_a, *region_b) {
|
||||
if region_known_to_outlive(
|
||||
tcx,
|
||||
item_def_id.def_id,
|
||||
param_env,
|
||||
&wf_tys,
|
||||
*region_a,
|
||||
*region_b,
|
||||
) {
|
||||
debug!(?region_a_idx, ?region_b_idx);
|
||||
debug!("required clause: {region_a} must outlive {region_b}");
|
||||
// Translate into the generic parameters of the GAT.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue