Skip to content

reflection: doc attributes from adts, fields, and variants - #165094

Open
Tess4552 wants to merge 1 commit into
rust-lang:mainfrom
Tess4552:reflection-type-id-docs
Open

Tess4552 wants to merge 1 commit into
rust-lang:mainfrom
Tess4552:reflection-type-id-docs

Conversation

@Tess4552

@Tess4552 Tess4552 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Adds intrinsics and methods to get the raw doc comment strings from adts, fields, and variants. As noted in the tracking issue #146922, before stabilizing the interface we should consider whether these methods get the raw strings.

r? @oli-obk

@rustbot

rustbot commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

The reflection data structures are tied exactly to the implementation
in the compiler. Make sure to also adjust rustc_const_eval/src/const_eval/type_info.rs

cc @oli-obk

Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter
gets adapted for the changes, if necessary.

cc @rust-lang/miri, @RalfJung, @oli-obk, @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. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 28, 2026
@rust-log-analyzer

This comment has been minimized.

@Tess4552
Tess4552 force-pushed the reflection-type-id-docs branch from a59d1d8 to c33e84e Compare October 28, 2026 17:48
)?;
}

sym::type_id_docs => {

@RalfJung RalfJung Oct 28, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The list of intrinsics here is growing so much that I think it'd make sense to move it to a separate file. (In a separate PR.)

View changes since the review

@rust-log-analyzer

This comment has been minimized.

@Tess4552
Tess4552 force-pushed the reflection-type-id-docs branch from c33e84e to d834d5c Compare October 28, 2026 20:53
}
}

sym::type_id_variant_docs => {

@oli-obk oli-obk Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should add a variant-pattern type (similar to what we do with FRTs instead of also having a field variant of many intrinsics) sooner rather than later instead of having to have all these intrinsics duplicated for variants and for normal types. Not for this PR, but just adding them to the type system without exposing them at the AST level shouldn't be too hard (famous last words)

View changes since the review

@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 Oct 29, 2026
@rustbot

rustbot commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@Tess4552
Tess4552 force-pushed the reflection-type-id-docs branch from d834d5c to b6997cd Compare October 29, 2026 12:11

@oli-obk oli-obk left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rust-bors

rust-bors Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

📌 Commit b6997cd has been tentatively approved by oli-obk

It will be put into the queue for this repository once PR CI succeeds.

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 29, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 29, 2026
…r=oli-obk

reflection: doc attributes from adts, fields, and variants

Adds intrinsics and methods to get the raw doc comment strings from adts, fields, and variants. As noted in the tracking issue rust-lang#146922, before stabilizing the interface we should consider whether these methods get the raw strings.

r? @oli-obk
@JonathanBrouwer

JonathanBrouwer commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

💔 I suspect this PR failed tests as part of a rollup
@bors r-

After fixing the problem, consider running a try job for the failed job before re-approving.

Link to failure: #165134 (comment)

Soft conflict with #165079, please wait for that to merge then rebase

@rust-bors rust-bors Bot 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 29, 2026
@rust-bors

rust-bors Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

This PR was contained in a rollup (#165134), which was unapproved.

View changes since this unapproval

This branch has not been deployed

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

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants