requiring item bounds for coinduction may be breaking
Open
Nobody has claimed this yet.
A-coinduction
T-types
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
our current plan to soundly support coinductive traits is to require proving the item bounds of a trait when using an implementation. Afaict this should break the following example:
trait WithSuper<T>: Copy {}
trait WithAliasBound {
type Assoc: Copy;
}
// With our approach to coinduction, using this impl should require
// proving `<T as WithAliasBound>::Assoc: Copy`
impl<T: WithAliasBound> WithSuper<T> for <T as WithAliasBound>::Assoc {}
fn impls_with_super<T: WithSuper<U>, U>() {}
fn item_bounds_not_checked<T: WithAliasBound<Assoc = U>, U>() {
impls_with_super::<U, T>();
// This uses the impl and would fail to prove `U: Copy`.
}
related issues
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reducing the Rust example in the issue and comparing its behavior with related issue #103899. Investigate how the compiler checks item bounds when using the coinductive trait implementation. Done means the example follows the intended soundness rules and has regression coverage for the observed behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100