Auto merge of #120346 - petrochenkov:ownodes, r=oli-obk
hir: Refactor getters for owner nodes
This commit is contained in:
commit
d53ddcd8bb
49 changed files with 918 additions and 925 deletions
|
@ -578,7 +578,7 @@ pub fn check_function_signature<'tcx>(
|
|||
fn_id: LocalDefId,
|
||||
) -> rustc_span::Span {
|
||||
let mut args = {
|
||||
let node = tcx.hir().expect_owner(fn_id);
|
||||
let node = tcx.expect_hir_owner_node(fn_id);
|
||||
let decl = node.fn_decl().unwrap_or_else(|| bug!("expected fn decl, found {:?}", node));
|
||||
decl.inputs.iter().map(|t| t.span).chain(std::iter::once(decl.output.span()))
|
||||
};
|
||||
|
|
|
@ -188,7 +188,7 @@ where
|
|||
}
|
||||
|
||||
fn check_well_formed(tcx: TyCtxt<'_>, def_id: hir::OwnerId) -> Result<(), ErrorGuaranteed> {
|
||||
let node = tcx.hir().owner(def_id);
|
||||
let node = tcx.hir_owner_node(def_id);
|
||||
let mut res = match node {
|
||||
hir::OwnerNode::Crate(_) => bug!("check_well_formed cannot be applied to the crate root"),
|
||||
hir::OwnerNode::Item(item) => check_item(tcx, item),
|
||||
|
|
|
@ -254,7 +254,7 @@ fn resolve_bound_vars(tcx: TyCtxt<'_>, local_def_id: hir::OwnerId) -> ResolveBou
|
|||
map: &mut named_variable_map,
|
||||
scope: &Scope::Root { opt_parent_item: None },
|
||||
};
|
||||
match tcx.hir().owner(local_def_id) {
|
||||
match tcx.hir_owner_node(local_def_id) {
|
||||
hir::OwnerNode::Item(item) => visitor.visit_item(item),
|
||||
hir::OwnerNode::ForeignItem(item) => visitor.visit_foreign_item(item),
|
||||
hir::OwnerNode::TraitItem(item) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue