Skip to content

Reflection TypeKind::FnPtr#152173

Open
9SonSteroids wants to merge 1 commit intorust-lang:mainfrom
9SonSteroids:fn_ptr_type_info
Open

Reflection TypeKind::FnPtr#152173
9SonSteroids wants to merge 1 commit intorust-lang:mainfrom
9SonSteroids:fn_ptr_type_info

Conversation

@9SonSteroids
Copy link

@9SonSteroids 9SonSteroids commented Feb 5, 2026

This is for #146922.

Const-eval currently lacks full support for function pointer (fn) types. We should implement handling of FnPtr TypeKind, covering safe and unsafe functions, Rust and custom ABIs, input and output types, higher-ranked lifetimes, and variadic functions.

@rustbot rustbot added 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. labels Feb 5, 2026
@9SonSteroids 9SonSteroids marked this pull request as ready for review February 5, 2026 15:23
@rustbot
Copy link
Collaborator

rustbot commented Feb 5, 2026

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

@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 Feb 5, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 5, 2026

r? @nnethercote

rustbot has assigned @nnethercote.
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

@9SonSteroids 9SonSteroids marked this pull request as draft February 5, 2026 15:29
@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 Feb 5, 2026
@9SonSteroids 9SonSteroids marked this pull request as ready for review February 5, 2026 17:09
@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 Feb 5, 2026
@SpriteOvO SpriteOvO added the F-type_info #![feature(type_info)] label Feb 5, 2026
@rust-log-analyzer

This comment has been minimized.

@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 Feb 5, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 5, 2026

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

@rustbot

This comment has been minimized.

@rustbot rustbot added the has-merge-commits PR has merge commits, merge with caution. label Feb 6, 2026
@rustbot

This comment has been minimized.

@rustbot rustbot removed has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 6, 2026
@9SonSteroids 9SonSteroids force-pushed the fn_ptr_type_info branch 2 times, most recently from 3f5227a to 3a540f2 Compare February 18, 2026 12:58
@oli-obk
Copy link
Contributor

oli-obk commented Feb 18, 2026

@bors r+ rollup

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 18, 2026

📌 Commit 3a540f2 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 18, 2026
@oli-obk
Copy link
Contributor

oli-obk commented Feb 18, 2026

@bors r-

@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 Feb 18, 2026
- Implement handling of FnPtr TypeKind in const-eval, including:
  - Unsafety flag (safe vs unsafe fn)
  - ABI variants (Rust, Named(C), Named(custom))
  - Input and output types
  - Variadic function pointers
- Add const-eval tests covering:
  - Basic Rust fn() pointers
  - Unsafe fn() pointers
  - Extern C and custom ABI pointers
  - Functions with multiple inputs and output types
  - Variadic functions
- Use const TypeId checks to verify correctness of inputs, outputs, and payloads
@oli-obk
Copy link
Contributor

oli-obk commented Feb 18, 2026

@bors r+ rollup

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 18, 2026

📌 Commit 7287be9 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 18, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 18, 2026
…li-obk

Reflection TypeKind::FnPtr

This is for rust-lang#146922.

Const-eval currently lacks full support for function pointer (fn) types. We should implement handling of FnPtr TypeKind, covering safe and unsafe functions, Rust and custom ABIs, input and output types, higher-ranked lifetimes, and variadic functions.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 18, 2026
…li-obk

Reflection TypeKind::FnPtr

This is for rust-lang#146922.

Const-eval currently lacks full support for function pointer (fn) types. We should implement handling of FnPtr TypeKind, covering safe and unsafe functions, Rust and custom ABIs, input and output types, higher-ranked lifetimes, and variadic functions.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 18, 2026
…li-obk

Reflection TypeKind::FnPtr

This is for rust-lang#146922.

Const-eval currently lacks full support for function pointer (fn) types. We should implement handling of FnPtr TypeKind, covering safe and unsafe functions, Rust and custom ABIs, input and output types, higher-ranked lifetimes, and variadic functions.
rust-bors bot pushed a commit that referenced this pull request Feb 18, 2026
…uwer

Rollup of 18 pull requests

Successful merges:

 - #152799 (Subtree sync for rustc_codegen_cranelift)
 - #152569 (Stop using rustc_layout_scalar_valid_range_* in rustc)
 - #151059 (x86: support passing `u128`/`i128` to inline assembly)
 - #152097 (Suggest local variables for captured format args)
 - #152734 (Respect the `--ci` flag in more places in bootstrap)
 - #151703 (Fix ICE in transmutability error reporting when type aliases are normalized)
 - #152173 (Reflection TypeKind::FnPtr)
 - #152564 (Remove unnecessary closure.)
 - #152628 (tests: rustc_public: Check const allocation for all variables (1 of 11 was missing))
 - #152658 (compiletest: normalize stderr before SVG rendering)
 - #152766 (std::r#try! - avoid link to nightly docs)
 - #152780 (Remove some clones in deriving)
 - #152787 (Add a mir-opt test for alignment check generation [zero changes outside tests])
 - #152790 (Fix incorrect target in aarch64-unknown-linux-gnu docs)
 - #152792 (Fix an ICE while checking param env shadowing on an erroneous trait impl)
 - #152793 (Do no add -no-pie on Windows)
 - #152803 (Avoid delayed-bug ICE for malformed diagnostic attrs)
 - #152806 (interpret: fix comment typo)
@JonathanBrouwer
Copy link
Contributor

@bors try jobs=dist-x86_64-linux-alt

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 18, 2026

⌛ Trying commit 7287be9 with merge 158ff82

To cancel the try build, run the command @bors try cancel.

Workflow: https://github.com/rust-lang/rust/actions/runs/22157374115

rust-bors bot pushed a commit that referenced this pull request Feb 18, 2026
Reflection TypeKind::FnPtr


try-job: dist-x86_64-linux-alt
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 18, 2026
…li-obk

Reflection TypeKind::FnPtr

This is for rust-lang#146922.

Const-eval currently lacks full support for function pointer (fn) types. We should implement handling of FnPtr TypeKind, covering safe and unsafe functions, Rust and custom ABIs, input and output types, higher-ranked lifetimes, and variadic functions.
@JonathanBrouwer
Copy link
Contributor

This PR was not the problem
@bors try cancel

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 18, 2026

Try build cancelled. Cancelled workflows:

rust-bors bot pushed a commit that referenced this pull request Feb 19, 2026
…uwer

Rollup of 18 pull requests

Successful merges:

 - #152799 (Subtree sync for rustc_codegen_cranelift)
 - #152814 (stdarch subtree update)
 - #151059 (x86: support passing `u128`/`i128` to inline assembly)
 - #152097 (Suggest local variables for captured format args)
 - #152734 (Respect the `--ci` flag in more places in bootstrap)
 - #151703 (Fix ICE in transmutability error reporting when type aliases are normalized)
 - #152173 (Reflection TypeKind::FnPtr)
 - #152564 (Remove unnecessary closure.)
 - #152628 (tests: rustc_public: Check const allocation for all variables (1 of 11 was missing))
 - #152658 (compiletest: normalize stderr before SVG rendering)
 - #152766 (std::r#try! - avoid link to nightly docs)
 - #152780 (Remove some clones in deriving)
 - #152787 (Add a mir-opt test for alignment check generation [zero changes outside tests])
 - #152790 (Fix incorrect target in aarch64-unknown-linux-gnu docs)
 - #152792 (Fix an ICE while checking param env shadowing on an erroneous trait impl)
 - #152793 (Do no add -no-pie on Windows)
 - #152803 (Avoid delayed-bug ICE for malformed diagnostic attrs)
 - #152806 (interpret: fix comment typo)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

F-type_info #![feature(type_info)] 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.

8 participants

Comments