Rename hir::Map::{get_,find_}parent_node to hir::Map::{,opt_}parent_id, and add hir::Map::{get,find}_parent#106403
Conversation
|
r? @cjgillot (rustbot has picked a reviewer for you, use r? to override) |
|
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
This comment has been minimized.
This comment has been minimized.
|
Well I did something wrong @rustbot author |
0a57f5d to
b4f6ee9
Compare
compiler/rustc_hir/src/hir.rs
Outdated
There was a problem hiding this comment.
At a glance, this seems incorrect.
There was a problem hiding this comment.
Can you be more specific?
get_parent_node(_: HirId) -> HirId was renamed to parent_id(_: HirId) -> HirId, and a new find_parent_node(_: HirId) -> Optiion<Node> was introduced.
There was a problem hiding this comment.
Didn't you introduce find_parent instead of find_parent_node?
r=me with the comment and PR title corrected.
There was a problem hiding this comment.
Wait -- what modification to the PR title do you want? Also mentioning adding {find,get}_parent?
edit: just did that.
b4f6ee9 to
59c9517
Compare
hir::Map::{get_,find_}parent_node to hir::Map::{,opt_}parent_idhir::Map::{get_,find_}parent_node to hir::Map::{,opt_}parent_id, and add hir::Map::{get,find}_parent
|
@bors r=cjgillot |
|
📌 Commit 59c95178848867f7cfca35dc8ddf2a217ef641f6 has been approved by It is now in the queue for this repository. |
|
☔ The latest upstream changes (presumably #105752) made this pull request unmergeable. Please resolve the merge conflicts. |
59c9517 to
b1b19bd
Compare
|
@bors r=cjgillot |
…, r=cjgillot
Rename `hir::Map::{get_,find_}parent_node` to `hir::Map::{,opt_}parent_id`, and add `hir::Map::{get,find}_parent`
The `hir::Map::get_parent_node` function doesn't return a `Node`, and I think that's quite confusing. Let's rename it to something that sounds more like something that gets the parent hir id => `hir::Map::parent_id`. Same with `find_parent_node` => `opt_parent_id`.
Also, combine `hir.get(hir.parent_id(hir_id))` and similar `hir.find(hir.parent_id(hir_id))` function into new functions that actually retrieve the parent node in one call. This last commit is the only one that might need to be looked at closely.
|
This is bitrotty @bors p=1 |
…mpiler-errors Rollup of 6 pull requests Successful merges: - rust-lang#105846 (Account for return-position `impl Trait` in trait in `opt_suggest_box_span`) - rust-lang#106385 (Split `-Zchalk` flag into `-Ztrait-solver=(classic|chalk|next)` flag) - rust-lang#106403 (Rename `hir::Map::{get_,find_}parent_node` to `hir::Map::{,opt_}parent_id`, and add `hir::Map::{get,find}_parent`) - rust-lang#106462 (rustdoc: remove unnecessary wrapper around sidebar and mobile logos) - rust-lang#106464 (Update Fuchsia walkthrough with new configs) - rust-lang#106478 (Tweak wording of fn call with wrong number of args) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
The
hir::Map::get_parent_nodefunction doesn't return aNode, and I think that's quite confusing. Let's rename it to something that sounds more like something that gets the parent hir id =>hir::Map::parent_id. Same withfind_parent_node=>opt_parent_id.Also, combine
hir.get(hir.parent_id(hir_id))and similarhir.find(hir.parent_id(hir_id))function into new functions that actually retrieve the parent node in one call. This last commit is the only one that might need to be looked at closely.