Skip to content

make Destruct trait coinductive - #162399

Draft
RedDaedalus wants to merge 1 commit into
rust-lang:mainfrom
RedDaedalus:destruct-coinductivity
Draft

RedDaedalus wants to merge 1 commit into
rust-lang:mainfrom
RedDaedalus:destruct-coinductivity

Conversation

@RedDaedalus

@RedDaedalus RedDaedalus commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Makes Destruct #[rustc_coinductive], and switches the goal source for the builtin Destruct impl conditions to ImplWhereBound, which is required for coinduction to apply. This allows recursive types to be Destruct. Fixes #162217

As a disclaimer, this is my first time contributing to the trait system so my knowledge of the internals is lacking and I may very well have taken the wrong approach/missed implications of the changes I made here. This code was hand-written without the assistance of an LLM.

@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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Sep 7, 2026
@RedDaedalus
RedDaedalus force-pushed the destruct-coinductivity branch from 566bf71 to 6e907e3 Compare September 7, 2026 05:03
@rust-bors

rust-bors Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #163583) made this pull request unmergeable. Please resolve the merge conflicts by rebasing.

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. 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.

Recursive types do not implement const Destruct even when their drop glue is const

2 participants