-
Notifications
You must be signed in to change notification settings - Fork 221
Open
Labels
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
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)
Reactions are currently unavailable