Skip to content

[WIP] Polymorphization - #160300

Draft
camelid wants to merge 17 commits into
rust-lang:mainfrom
camelid:poly
Draft

[WIP] Polymorphization#160300
camelid wants to merge 17 commits into
rust-lang:mainfrom
camelid:poly

Conversation

@camelid

@camelid camelid commented Jul 31, 2026

Copy link
Copy Markdown
Member

No description provided.

camelid added 17 commits July 27, 2026 19:34
core seems to build successfully now, but miniz_oxide ICEs due to
ty_and_layout_field.
Params are local to the function that defines them, but ty::Erased was
leaking since called functions and shims may be monomorphized with it as
an argument. Will need a more principled approach that allows tracking
parameter identity so we can do the sidecar/vtable rewrite for calls
that passes type_id, drop, trait methods, etc.

However, std successfully builds now and can be linked against from a
simple test case that runs!

Also had to move an instance.polymorphize() call earlier in symbol
mangling to avoid discrepancy. Obviously need a new approach that avoids
this ad hoc ness.
randomization_seed prevents polymorphizing instances for types with the
same layout but different origins (e.g. two different structs).
@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc 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.

2 participants