E0264
A method call that two or more of the receiver's traits (or a parameter's bounds) provide, when the type's own impl does not. Spans the method name. Call it qualified instead: Display.to_string(x).
Machine-applicable fix: none.
Example
This program fails with E0264.
trait Short {
fn describe(self) -> String
}
trait Long {
fn describe(self) -> String
}
struct Cat { name: String }
impl Short for Cat {
fn describe(self) -> String {
"cat"
}
}
impl Long for Cat {
fn describe(self) -> String {
"a cat"
}
}
fn show(c: Cat) -> String {
c.describe()
}
Fixed
The same program, fixed.
trait Short {
fn describe(self) -> String
}
trait Long {
fn describe(self) -> String
}
struct Cat { name: String }
impl Short for Cat {
fn describe(self) -> String {
"cat"
}
}
impl Long for Cat {
fn describe(self) -> String {
"a cat"
}
}
fn show(c: Cat) -> String {
Short.describe(c)
}
Listed in the checker notes. oskac explain E0264 prints this entry offline.