E4100

E4100#

该类型不是一个特征。

当你为类型定义别名并将其用作特征时,会发生此错误。由于类型不能作为特征使用,因此此错误可能提示代码中存在拼写错误。

错误示例#

///|
pub struct Original(Int)

///|
type Alias = Original

///|
pub trait Trait: Alias {
  //         ^~~~~
  // Error: The type Alias is not a trait
}

建议#

如果存在拼写错误,请在出错位置使用正确的特征。

///|
pub trait Original {
  to_int(Self) -> Int
}

///|
pub trait Trait: Original {
  to_int(Self) -> Int
}

在特征声明中,: 后面只能出现特征。