Compiler crash when implementing a trait with unmet supertrait bound
Open
@philberty is already working on this.
Since Jun 23, 2026.
bug
- Dominant language
- C++
- Stars
- 2.9k
- Forks
- 231
- Avg merge
- 19h 55m
- Merged PRs (30d)
- 67
Description
Code
trait UnitValue: NewTrait {
fn value(&self) -> i32;
}
impl UnitValue for i32 {
fn value(&self) -> i32 {
*self
}
}
trait UnitExt: UnitValue {
fn double_value(&self) -> i32 {
self.value() + self.value()
}
}
impl<T: UnitValue> UnitExt for T {}
pub fn main() {
let _x = 42;
let _y = test().double_value();
}
fn test() -> impl UnitValue {
100
}
trait NewTrait<const N: usize> {}
Meta
1a91028
Error output
bug.rs:9:6: error: the trait bound ‘i32: NewTrait’ is not satisfied [E0277]
6 | trait UnitValue: NewTrait {
| required by this bound in: UnitValue
......
9 | impl UnitValue for i32 {
| ^~~~~~~~~
| the trait NewTrait is not implemented for i32
bug.rs:19:20: error: the trait bound ‘T: NewTrait’ is not satisfied [E0277]
6 | trait UnitValue: NewTrait {
| required by this bound in: UnitValue
......
19 | impl<T: UnitValue> UnitExt for T {}
| ^~~~~~~
| the trait NewTrait is not implemented for T
Segmentation fault (core dumped)
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.
Assessment
This issue has not been assessed yet.