Skip to content

Rename some body_id to body_def_id#158696

Open
camsteffen wants to merge 1 commit into
rust-lang:mainfrom
camsteffen:body-id
Open

Rename some body_id to body_def_id#158696
camsteffen wants to merge 1 commit into
rust-lang:mainfrom
camsteffen:body-id

Conversation

@camsteffen

@camsteffen camsteffen commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Since body IDs and item IDs are distinct things, try to use names that do not conflate them. body_def_id is a little easier to read as "body-owning definition ID" whereas body_id is hard not to just read as "body ID".

Related: #158611 - I noticed this afterwards. I suspect that FnCtxt ought to keep body_def_id but maybe add body_id: BodyId in addition.

@rustbot

rustbot commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred to the core trait solver

cc @rust-lang/initiative-trait-system-refactor

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

changes to the core type system

cc @lcnr

Some changes occurred to constck

cc @fee1-dead

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred in need_type_info.rs

cc @lcnr

Some changes occurred in engine.rs, potentially modifying the public API of ObligationCtxt.

cc @lcnr

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Jul 2, 2026
@rustbot

rustbot commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

r? @oli-obk

rustbot has assigned @oli-obk.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler, types
  • compiler, types expanded to 75 candidates
  • Random selection from 20 candidates

@oli-obk

oli-obk commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

hmm... various of those are not items. The DefId of a const block has a body, but is not an item. I don't know if this really is an improvement even in the few cases where it may be unambiguous. Is there some other discussions that led you to doing this PR?

@camsteffen

camsteffen commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

hmm... various of those are not items.

Okay, that's my mistake, I thought they were. How about body_owner_id or def_id or body_def_id? body_id just seems like a misleading misnomer to me. No other discussions to my knowledge, just my own idea.

@camsteffen camsteffen marked this pull request as draft July 2, 2026 18:52
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 2, 2026
@camsteffen

Copy link
Copy Markdown
Contributor Author

I noticed that body_def_id is used sometimes throughout the codebase, so I changed to using that name instead of body_id more consistently. Admittedly this is now a pretty subtle change that may not be worth the churn. But I do think body_def_id is a little easier to understand as "body-owning definition ID".

`body_id` is often used to mean "ID of a body-owning node", which is
confusing since the obvious reading as "body ID" is wrong.

`body_def_id` is easier to read as "body-owning definition ID".
@camsteffen camsteffen changed the title Rename body_id to item_id where applicable Rename some body_id to body_def_id Jul 2, 2026
@camsteffen camsteffen marked this pull request as ready for review July 2, 2026 20:39
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 2, 2026
@rust-bors

rust-bors Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #158795) made this pull request unmergeable. Please resolve the merge conflicts by rebasing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants