Move methods from Map
to TyCtxt
, part 4.
Continuing the work from #137350. Removes the unused methods: `expect_variant`, `expect_field`, `expect_foreign_item`. Every method gains a `hir_` prefix.
This commit is contained in:
parent
281af35cc3
commit
256c27e748
115 changed files with 269 additions and 321 deletions
|
@ -485,7 +485,7 @@ fn construct_fn<'tcx>(
|
|||
};
|
||||
|
||||
if let Some(custom_mir_attr) =
|
||||
tcx.hir().attrs(fn_id).iter().find(|attr| attr.name_or_empty() == sym::custom_mir)
|
||||
tcx.hir_attrs(fn_id).iter().find(|attr| attr.name_or_empty() == sym::custom_mir)
|
||||
{
|
||||
return custom::build_custom_mir(
|
||||
tcx,
|
||||
|
@ -741,7 +741,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
coroutine: Option<Box<CoroutineInfo<'tcx>>>,
|
||||
) -> Builder<'a, 'tcx> {
|
||||
let tcx = infcx.tcx;
|
||||
let attrs = tcx.hir().attrs(hir_id);
|
||||
let attrs = tcx.hir_attrs(hir_id);
|
||||
// Some functions always have overflow checks enabled,
|
||||
// however, they may not get codegen'd, depending on
|
||||
// the settings for the crate they are codegened in.
|
||||
|
|
|
@ -942,14 +942,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
assert_eq!(orig_id.owner, self.hir_id.owner);
|
||||
|
||||
let mut id = orig_id;
|
||||
let hir = self.tcx.hir();
|
||||
loop {
|
||||
if id == self.hir_id {
|
||||
// This is a moderately common case, mostly hit for previously unseen nodes.
|
||||
break;
|
||||
}
|
||||
|
||||
if hir.attrs(id).iter().any(|attr| Level::from_attr(attr).is_some()) {
|
||||
if self.tcx.hir_attrs(id).iter().any(|attr| Level::from_attr(attr).is_some()) {
|
||||
// This is a rare case. It's for a node path that doesn't reach the root due to an
|
||||
// intervening lint level attribute. This result doesn't get cached.
|
||||
return id;
|
||||
|
|
|
@ -1041,7 +1041,7 @@ impl<'tcx> ThirBuildCx<'tcx> {
|
|||
"Should have already errored about late bound consts: {def_id:?}"
|
||||
);
|
||||
};
|
||||
let name = self.tcx.hir().name(hir_id);
|
||||
let name = self.tcx.hir_name(hir_id);
|
||||
let param = ty::ParamConst::new(index, name);
|
||||
|
||||
ExprKind::ConstParam { param, def_id }
|
||||
|
|
|
@ -73,7 +73,6 @@ struct ThirBuildCx<'tcx> {
|
|||
impl<'tcx> ThirBuildCx<'tcx> {
|
||||
fn new(tcx: TyCtxt<'tcx>, def: LocalDefId) -> Self {
|
||||
let typeck_results = tcx.typeck(def);
|
||||
let hir = tcx.hir();
|
||||
let hir_id = tcx.local_def_id_to_hir_id(def);
|
||||
|
||||
let body_type = match tcx.hir_body_owner_kind(def) {
|
||||
|
@ -111,8 +110,8 @@ impl<'tcx> ThirBuildCx<'tcx> {
|
|||
typeck_results,
|
||||
rvalue_scopes: &typeck_results.rvalue_scopes,
|
||||
body_owner: def.to_def_id(),
|
||||
apply_adjustments: hir
|
||||
.attrs(hir_id)
|
||||
apply_adjustments: tcx
|
||||
.hir_attrs(hir_id)
|
||||
.iter()
|
||||
.all(|attr| attr.name_or_empty() != rustc_span::sym::custom_mir),
|
||||
}
|
||||
|
|
|
@ -1043,7 +1043,7 @@ fn find_fallback_pattern_typo<'tcx>(
|
|||
for item in cx.tcx.hir_crate_items(()).free_items() {
|
||||
if let DefKind::Use = cx.tcx.def_kind(item.owner_id) {
|
||||
// Look for consts being re-exported.
|
||||
let item = cx.tcx.hir().expect_item(item.owner_id.def_id);
|
||||
let item = cx.tcx.hir_expect_item(item.owner_id.def_id);
|
||||
let use_name = item.ident.name;
|
||||
let hir::ItemKind::Use(path, _) = item.kind else {
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue