rename get_parent_node to parent_id
This commit is contained in:
parent
c7572670a1
commit
a313ef05a7
48 changed files with 119 additions and 121 deletions
|
@ -117,7 +117,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
Some(if movability.is_some() { "an async closure" } else { "a closure" })
|
||||
}),
|
||||
hir::Node::Expr(hir::Expr { .. }) => {
|
||||
let parent_hid = hir.get_parent_node(hir_id);
|
||||
let parent_hid = hir.parent_id(hir_id);
|
||||
if parent_hid != hir_id { self.describe_enclosure(parent_hid) } else { None }
|
||||
}
|
||||
_ => None,
|
||||
|
|
|
@ -838,7 +838,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
|
||||
let hir = self.tcx.hir();
|
||||
let hir_id = hir.local_def_id_to_hir_id(def_id.as_local()?);
|
||||
let parent_node = hir.get_parent_node(hir_id);
|
||||
let parent_node = hir.parent_id(hir_id);
|
||||
match hir.find(parent_node) {
|
||||
Some(hir::Node::Stmt(hir::Stmt { kind: hir::StmtKind::Local(local), .. })) => {
|
||||
get_name(err, &local.pat.kind)
|
||||
|
@ -1421,7 +1421,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
trait_pred: ty::PolyTraitPredicate<'tcx>,
|
||||
) -> bool {
|
||||
let hir = self.tcx.hir();
|
||||
let parent_node = hir.get_parent_node(obligation.cause.body_id);
|
||||
let parent_node = hir.parent_id(obligation.cause.body_id);
|
||||
let node = hir.find(parent_node);
|
||||
if let Some(hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn(sig, _, body_id), .. })) = node
|
||||
&& let hir::ExprKind::Block(blk, _) = &hir.body(*body_id).value.kind
|
||||
|
@ -1458,7 +1458,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
|
||||
fn return_type_span(&self, obligation: &PredicateObligation<'tcx>) -> Option<Span> {
|
||||
let hir = self.tcx.hir();
|
||||
let parent_node = hir.get_parent_node(obligation.cause.body_id);
|
||||
let parent_node = hir.parent_id(obligation.cause.body_id);
|
||||
let Some(hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn(sig, ..), .. })) = hir.find(parent_node) else {
|
||||
return None;
|
||||
};
|
||||
|
@ -1483,7 +1483,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
}
|
||||
|
||||
let hir = self.tcx.hir();
|
||||
let fn_hir_id = hir.get_parent_node(obligation.cause.body_id);
|
||||
let fn_hir_id = hir.parent_id(obligation.cause.body_id);
|
||||
let node = hir.find(fn_hir_id);
|
||||
let Some(hir::Node::Item(hir::Item {
|
||||
kind: hir::ItemKind::Fn(sig, _, body_id),
|
||||
|
@ -1695,7 +1695,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
}
|
||||
|
||||
let hir = self.tcx.hir();
|
||||
let parent_node = hir.get_parent_node(obligation.cause.body_id);
|
||||
let parent_node = hir.parent_id(obligation.cause.body_id);
|
||||
let node = hir.find(parent_node);
|
||||
if let Some(hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn(_, _, body_id), .. })) =
|
||||
node
|
||||
|
@ -2291,7 +2291,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
let expr = hir.expect_expr(expr_id);
|
||||
debug!("target_ty evaluated from {:?}", expr);
|
||||
|
||||
let parent = hir.get_parent_node(expr_id);
|
||||
let parent = hir.parent_id(expr_id);
|
||||
if let Some(hir::Node::Expr(e)) = hir.find(parent) {
|
||||
let parent_span = hir.span(parent);
|
||||
let parent_did = parent.owner.to_def_id();
|
||||
|
@ -2512,7 +2512,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
}
|
||||
}
|
||||
ObligationCauseCode::VariableType(hir_id) => {
|
||||
let parent_node = self.tcx.hir().get_parent_node(hir_id);
|
||||
let parent_node = self.tcx.hir().parent_id(hir_id);
|
||||
match self.tcx.hir().find(parent_node) {
|
||||
Some(Node::Local(hir::Local { ty: Some(ty), .. })) => {
|
||||
err.span_suggestion_verbose(
|
||||
|
@ -2992,7 +2992,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
span: Span,
|
||||
) {
|
||||
let body_hir_id = obligation.cause.body_id;
|
||||
let item_id = self.tcx.hir().get_parent_node(body_hir_id);
|
||||
let item_id = self.tcx.hir().parent_id(body_hir_id);
|
||||
|
||||
if let Some(body_id) =
|
||||
self.tcx.hir().maybe_body_owned_by(self.tcx.hir().local_def_id(item_id))
|
||||
|
@ -3219,7 +3219,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
if let hir::ExprKind::Path(hir::QPath::Resolved(None, path)) = expr.kind
|
||||
&& let hir::Path { res: hir::def::Res::Local(hir_id), .. } = path
|
||||
&& let Some(hir::Node::Pat(binding)) = self.tcx.hir().find(*hir_id)
|
||||
&& let parent_hir_id = self.tcx.hir().get_parent_node(binding.hir_id)
|
||||
&& let parent_hir_id = self.tcx.hir().parent_id(binding.hir_id)
|
||||
&& let Some(hir::Node::Local(local)) = self.tcx.hir().find(parent_hir_id)
|
||||
&& let Some(binding_expr) = local.init
|
||||
{
|
||||
|
@ -3287,7 +3287,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
if let hir::ExprKind::Path(hir::QPath::Resolved(None, path)) = expr.kind
|
||||
&& let hir::Path { res: hir::def::Res::Local(hir_id), .. } = path
|
||||
&& let Some(hir::Node::Pat(binding)) = self.tcx.hir().find(*hir_id)
|
||||
&& let parent_hir_id = self.tcx.hir().get_parent_node(binding.hir_id)
|
||||
&& let parent_hir_id = self.tcx.hir().parent_id(binding.hir_id)
|
||||
&& let Some(parent) = self.tcx.hir().find(parent_hir_id)
|
||||
{
|
||||
// We've reached the root of the method call chain...
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue