E4100#
The type is not a trait.
This error occurs when you try to use the typealias
syntax to define a alias
for a type and use it as a trait. As it is impossible to use a type as a trait,
this error might hint at a typo in your code.
错误示例#
type Original Int
typealias Alias = Original
trait Trait: Alias {
// ^~~~~
// Error: The type Alias is not a trait
}
建议#
If there is a typo, the use a correct trait or alias of trait at where the error occurs.
trait Original {
to_int(Self) -> Int
}
typealias Alias = Original
trait Trait: Alias {
to_int(Self) -> Int
}
We recommend using traitalias
for defining aliases for traits, as this will
detect errors like this earlier.