Skip to content

Expose more info about ADTs and functions in rustc_public#157993

Open
erickt wants to merge 1 commit into
rust-lang:mainfrom
erickt:rustc-public
Open

Expose more info about ADTs and functions in rustc_public#157993
erickt wants to merge 1 commit into
rust-lang:mainfrom
erickt:rustc-public

Conversation

@erickt

@erickt erickt commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

This allows users of rustc_public to do more complex navigation through data structures by exposing the following info:

  • AdtDef::generics_of - Get the generics for the ADT.
  • AdtDef::inherent_impls - Get all the impls for the ADT.
  • FnDef::associated_item - Get the trait or impl block that contains the function if it exists.
  • FnDef::generics_of - get the generics for a given function.
  • ImplDef::generics_of - Get the generics for the impl block.
  • ImplDef implements CrateDefType - figure out the type of the impl block with CrateDefType::ty() or get the normalized type with CrateDefType::ty_with_args().

This was partially written with the help of Gemini, but I reviewed the code it generated.

@rustbot

rustbot commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

This PR changes rustc_public

cc @oli-obk, @celinval, @ouz-a, @makai410

@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. labels Jun 16, 2026
@rustbot

rustbot commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

r? @TaKO8Ki

rustbot has assigned @TaKO8Ki.
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
  • compiler expanded to 73 candidates
  • Random selection from 20 candidates

This allows users of `rustc_public` to do more complex navigation
through data structures by exposing the following info:

* `AdtDef::generics_of` - Get the generics for the ADT.
* `AdtDef::inherent_impls` - Get all the impls for the ADT.
* `FnDef::associated_item` - Get the trait or impl block that contains the
  function if it exists.
* `FnDef::generics_of` - get the generics for a given function.
* `ImplDef::generics_of` - Get the generics for the impl block.
* `ImplDef` implements `CrateDefType` - figure out the type of the impl
  block with `CrateDefType::ty()` or get the normalized type with
`CrateDefType::ty_with_args()`.

This was partially written with the help of Gemini, but I reviewed the
code it generated.
@rustbot

rustbot commented Jun 16, 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.

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants