Constraint information is not propagated
Open
Nobody has claimed this yet.
T-lang
- Dominant language
- Markdown
- Stars
- 6.6k
- Forks
- 1.7k
- Avg merge
- 16h 14m
- Merged PRs (30d)
- 1
Description
I would expect this code to compile, but it does not:
use std::ops::{Mul};
pub trait M: Sized where f64: Mul<Self, Output=Self> {
}
pub trait M2: M {
fn f(self, a: f64) -> Self {
a * self
}
}
Having to repeat constraints leads to more verbose code and is only repeating information that the compiler already knows.
See previous discussion: https://github.com/rust-lang/rust/issues/26564
Contributor guide
No contributing guide indexed for this repository
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 with the Rust code example in the issue and read the linked previous discussion in issue #26564. The desired outcome is for the compiler to propagate the Mul constraint from M so that M2::f does not repeat it, but the issue does not identify implementation files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100