Rust-GCC / Rust-GCC/gccrs

Compiler crash when implementing a trait with unmet supertrait bound

Open
#4,493 4 comments 0 reactions 1 assignee View on GitHub

@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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.