Skip to content

Rename some body_id to body_def_id#158696

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
camsteffen:body-id
Jul 8, 2026
Merged

Rename some body_id to body_def_id#158696
rust-bors[bot] merged 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".

@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

This comment has been minimized.

@oli-obk

oli-obk commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

r=me after a rebase

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

`body_def_id` is easier to read as "body-owning definition ID".
@rustbot

rustbot commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@oli-obk

oli-obk commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

@bors r+

@rust-bors

rust-bors Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

📌 Commit f13657c has been approved by oli-obk

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 7, 2026
m-ou-se added a commit to m-ou-se/rust that referenced this pull request Jul 7, 2026
Rename some `body_id` to `body_def_id`

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: rust-lang#158611 - I noticed this afterwards. I suspect that `FnCtxt` ought to keep `body_def_id` but maybe add `body_id: BodyId` in addition.
rust-bors Bot pushed a commit that referenced this pull request Jul 7, 2026
Rollup of 8 pull requests

Successful merges:

 - #156968 (diagnostics: suggest generic_const_args for const ops)
 - #158617 (allow mGCA const arguments to fall back to anon consts)
 - #158690 (delegation: support mapping of all arguments with `Self` type)
 - #158696 (Rename some `body_id` to `body_def_id`)
 - #158333 (Fix typetree generation for differentiated functions)
 - #158646 (powerpc64le_unknown_freebsd.rs: link with -lgcc)
 - #158802 (Use `ci-mirrors` in `armhf-gnu` for {busybox, ubuntu rootfs} artifacts)
 - #158905 (delegation: add constraints to new generic args)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 7, 2026
Rename some `body_id` to `body_def_id`

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: rust-lang#158611 - I noticed this afterwards. I suspect that `FnCtxt` ought to keep `body_def_id` but maybe add `body_id: BodyId` in addition.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 7, 2026
Rename some `body_id` to `body_def_id`

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: rust-lang#158611 - I noticed this afterwards. I suspect that `FnCtxt` ought to keep `body_def_id` but maybe add `body_id: BodyId` in addition.
rust-bors Bot pushed a commit that referenced this pull request Jul 7, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - #158179 (std: unconditionally use `preadv`/`pwritev` on AArch64 macOS)
 - #158617 (allow mGCA const arguments to fall back to anon consts)
 - #158621 (disallow `extern "custom"` on wasm and spirv targets)
 - #158690 (delegation: support mapping of all arguments with `Self` type)
 - #158696 (Rename some `body_id` to `body_def_id`)
 - #158333 (Fix typetree generation for differentiated functions)
 - #158646 (powerpc64le_unknown_freebsd.rs: link with -lgcc)
 - #158791 (Avoid unused braces lint for macro generated arguments)
 - #158802 (Use `ci-mirrors` in `armhf-gnu` for {busybox, ubuntu rootfs} artifacts)
 - #158889 (tests: catch up with LLVM returning f128 on the stack)
 - #158905 (delegation: add constraints to new generic args)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 7, 2026
Rename some `body_id` to `body_def_id`

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: rust-lang#158611 - I noticed this afterwards. I suspect that `FnCtxt` ought to keep `body_def_id` but maybe add `body_id: BodyId` in addition.
rust-bors Bot pushed a commit that referenced this pull request Jul 7, 2026
…uwer

Rollup of 18 pull requests

Successful merges:

 - #157385 (Enable Enzyme on x86_64-apple)
 - #157561 (rustdoc: do not include extra stuff in span)
 - #158179 (std: unconditionally use `preadv`/`pwritev` on AArch64 macOS)
 - #158617 (allow mGCA const arguments to fall back to anon consts)
 - #158621 (disallow `extern "custom"` on wasm and spirv targets)
 - #158690 (delegation: support mapping of all arguments with `Self` type)
 - #158696 (Rename some `body_id` to `body_def_id`)
 - #158697 (Fixes for QNX SDP 8)
 - #158760 (Clarify that `LocalKey::try_with` may return `AccessError`)
 - #157801 (Rewrite safety requirements for `Allocator` impls)
 - #158333 (Fix typetree generation for differentiated functions)
 - #158646 (powerpc64le_unknown_freebsd.rs: link with -lgcc)
 - #158701 ( diagnostics: suggest type annotation for closure params on HRTB FnOnce mismatch)
 - #158791 (Avoid unused braces lint for macro generated arguments)
 - #158802 (Use `ci-mirrors` in `armhf-gnu` for {busybox, ubuntu rootfs} artifacts)
 - #158841 (Avoid final override ICE for RPITIT associated types)
 - #158889 (tests: catch up with LLVM returning f128 on the stack)
 - #158905 (delegation: add constraints to new generic args)
rust-bors Bot pushed a commit that referenced this pull request Jul 7, 2026
…uwer

Rollup of 19 pull requests

Successful merges:

 - #156016 (view-types: store view types in the AST)
 - #157385 (Enable Enzyme on x86_64-apple)
 - #158179 (std: unconditionally use `preadv`/`pwritev` on AArch64 macOS)
 - #158621 (disallow `extern "custom"` on wasm and spirv targets)
 - #158690 (delegation: support mapping of all arguments with `Self` type)
 - #158696 (Rename some `body_id` to `body_def_id`)
 - #158697 (Fixes for QNX SDP 8)
 - #158760 (Clarify that `LocalKey::try_with` may return `AccessError`)
 - #157801 (Rewrite safety requirements for `Allocator` impls)
 - #158085 (rustdoc: Fix sidebar heading order)
 - #158333 (Fix typetree generation for differentiated functions)
 - #158646 (powerpc64le_unknown_freebsd.rs: link with -lgcc)
 - #158701 ( diagnostics: suggest type annotation for closure params on HRTB FnOnce mismatch)
 - #158791 (Avoid unused braces lint for macro generated arguments)
 - #158802 (Use `ci-mirrors` in `armhf-gnu` for {busybox, ubuntu rootfs} artifacts)
 - #158841 (Avoid final override ICE for RPITIT associated types)
 - #158889 (tests: catch up with LLVM returning f128 on the stack)
 - #158905 (delegation: add constraints to new generic args)
 - #158922 (tests: clean up over-constraint on LLVM feature count)

Failed merges:

 - #158617 (allow mGCA const arguments to fall back to anon consts)
@rust-bors rust-bors Bot merged commit 2ff42bf into rust-lang:main Jul 8, 2026
13 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Jul 8, 2026
rust-timer added a commit that referenced this pull request Jul 8, 2026
Rollup merge of #158696 - camsteffen:body-id, r=oli-obk

Rename some `body_id` to `body_def_id`

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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