Skip to content

Reflection refactor ptrs - #162294

Merged
rust-bors[bot] merged 6 commits into
rust-lang:mainfrom
yara-blue:reflection-refactor-ptrs
Sep 7, 2026
Merged

rust-bors[bot] merged 6 commits into
rust-lang:mainfrom
yara-blue:reflection-refactor-ptrs

Conversation

@yara-blue

Copy link
Copy Markdown
Contributor

Tracking issue #146922

Part of the Refactoring to many methods reflection subgoal. See that for the full context. In short for various reasons we are moving from an enum TypeKind where the variants hold the types information to one that just tells you the type kind. Separate methods on TypeId provide a way to get to the data that used to be in the variant.

Since function pointers have a lot of fields it felt better to keep the FnPtr struct we have now then add an intrinsic for each field.

r? @oli-obk

@rustbot

rustbot commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

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

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 CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

Some changes occurred in compiler/rustc_attr_ir

cc @jdonszelmann, @JonathanBrouwer

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) 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 Sep 4, 2026
@rustbot

rustbot commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

oli-obk is not on the review rotation at the moment.
They may take a while to respond.

Comment thread compiler/rustc_attr_ir/src/lang_items.rs
Comment thread compiler/rustc_const_eval/src/const_eval/machine.rs
@yara-blue
yara-blue force-pushed the reflection-refactor-ptrs branch 2 times, most recently from 52f2e49 to b9b9421 Compare September 4, 2026 13:21

@yara-blue yara-blue Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I originally did a straightforward port of these tests but decided to "uncouple" (testing only one "thing" per test) them also. Happy rewrite as a straightforward port.

View changes since the review

@rust-log-analyzer

This comment has been minimized.

@yara-blue
yara-blue force-pushed the reflection-refactor-ptrs branch from b9b9421 to 06fa642 Compare September 4, 2026 17:28
Comment thread library/core/src/mem/type_info.rs Outdated
@oli-obk

oli-obk commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

@bors r+ rollup

@rust-bors

rust-bors Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 06fa642 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 Sep 7, 2026
rust-bors Bot pushed a commit that referenced this pull request Sep 7, 2026
…uwer

Rollup of 3 pull requests

Successful merges:

 - #161896 (Remove fields from TypeKind: Array, Slice)
 - #162354 (Make comptime functions ineligible for coverage)
 - #162379 (add test ensuring we refuse to const-eval the body of a rustc_do_not_const_check function)

Failed merges:

 - #162294 (Reflection refactor ptrs)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Sep 7, 2026
…, r=oli-obk

Reflection refactor ptrs

Tracking issue rust-lang#146922

Part of the [Refactoring to many methods](https://rust-lang.zulipchat.com/#narrow/channel/572285-goals.2Freflection/topic/Refactoring.20to.20many.20methods/with/592226560) reflection subgoal. See that for the full context. In short for various reasons we are moving from an enum `TypeKind` where the variants hold the types information to one that just tells you the type kind. Separate methods on `TypeId` provide a way to get to the data that used to be in the variant.

Since function pointers have a lot of fields it felt better to keep the `FnPtr` struct we have now then add an intrinsic for each field.

r? @oli-obk
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Sep 7, 2026
…, r=oli-obk

Reflection refactor ptrs

Tracking issue rust-lang#146922

Part of the [Refactoring to many methods](https://rust-lang.zulipchat.com/#narrow/channel/572285-goals.2Freflection/topic/Refactoring.20to.20many.20methods/with/592226560) reflection subgoal. See that for the full context. In short for various reasons we are moving from an enum `TypeKind` where the variants hold the types information to one that just tells you the type kind. Separate methods on `TypeId` provide a way to get to the data that used to be in the variant.

Since function pointers have a lot of fields it felt better to keep the `FnPtr` struct we have now then add an intrinsic for each field.

r? @oli-obk
rust-bors Bot pushed a commit that referenced this pull request Sep 7, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - #158153 (avoid spurious lifetime diagnostic in async generic case)
 - #160197 (Restrict LLVM inline asm location cookie usage. Fixes #150451)
 - #162413 (Unconditionally invalidate the library when the compiler changes)
 - #162294 (Reflection refactor ptrs)
 - #162354 (Make comptime functions ineligible for coverage)
 - #162379 (add test ensuring we refuse to const-eval the body of a rustc_do_not_const_check function)
 - #162386 (Add a regression test for trailing attributes in doctests)
 - #162410 (std: remove exceed whitespace in docs)
 - #162420 (mir_build: Don't pass a redundant `scrutinee_span` to some MIR-build methods)
 - #162430 (rustc-dev-guide subtree update)
 - #162431 (add next-solver FIXMEs)
@rust-bors
rust-bors Bot merged commit 706214d into rust-lang:main Sep 7, 2026
13 checks passed
@rustbot rustbot added this to the 1.100.0 milestone Sep 7, 2026
rust-bors Bot pushed a commit that referenced this pull request Sep 7, 2026
Rollup merge of #162294 - yara-blue:reflection-refactor-ptrs, r=oli-obk

Reflection refactor ptrs

Tracking issue #146922

Part of the [Refactoring to many methods](https://rust-lang.zulipchat.com/#narrow/channel/572285-goals.2Freflection/topic/Refactoring.20to.20many.20methods/with/592226560) reflection subgoal. See that for the full context. In short for various reasons we are moving from an enum `TypeKind` where the variants hold the types information to one that just tells you the type kind. Separate methods on `TypeId` provide a way to get to the data that used to be in the variant.

Since function pointers have a lot of fields it felt better to keep the `FnPtr` struct we have now then add an intrinsic for each field.

r? @oli-obk
github-actions Bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Sep 14, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#158153 (avoid spurious lifetime diagnostic in async generic case)
 - rust-lang/rust#160197 (Restrict LLVM inline asm location cookie usage. Fixes rust-lang/rust#150451)
 - rust-lang/rust#162413 (Unconditionally invalidate the library when the compiler changes)
 - rust-lang/rust#162294 (Reflection refactor ptrs)
 - rust-lang/rust#162354 (Make comptime functions ineligible for coverage)
 - rust-lang/rust#162379 (add test ensuring we refuse to const-eval the body of a rustc_do_not_const_check function)
 - rust-lang/rust#162386 (Add a regression test for trailing attributes in doctests)
 - rust-lang/rust#162410 (std: remove exceed whitespace in docs)
 - rust-lang/rust#162420 (mir_build: Don't pass a redundant `scrutinee_span` to some MIR-build methods)
 - rust-lang/rust#162430 (rustc-dev-guide subtree update)
 - rust-lang/rust#162431 (add next-solver FIXMEs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) 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. 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.

4 participants