#E0016: 在没有意义的位置使用可见性
pub 写在了不起任何作用的地方:块中的函数或项(它只在该块中可见),或者枚举变体(变体采用枚举的可见性)。删除它。
nabi
enum Color { pub Red, Blue }
error[E0016]: enum variants take the enum's visibility; remove the visibility keyword --> main.nabi:1:14 | 1 | enum Color { pub Red, Blue } | ^^^
删除变体上的 pub;要让变体可见,把枚举标为 pub。
nabi
#[derive(Debug)]
pub enum Color { Red, Blue }
println(f"{Color::Red:?}");
Red
相关错误码:E0034 项是私有的
发现错误? 在 GitHub 上编辑此页 最后更新: