ZhangHanDong/tao-of-rust-codes

cannot specialize default item `swim`

BH1SCW opened this issue · 1 comments

页码与行数

src/ch03/trait_limit.rs:157:9


Rust版本

$ rustc -V
rustc 1.64.0-nightly (c80c4b8fd 2022-06-26)

错误信息

error[E0520]: `swim` specializes an item from a parent `impl`, but that item is not marked `default`
   --> src/ch03/trait_limit.rs:157:9
    |
154 |       impl<T> Swimmer for Diver<T> {}
    |       ------------------------------- parent `impl` is here
157 | /         fn swim(&self) {
158 | |             println!("drowning, help!")
159 | |         }
    | |_________^ cannot specialize default item `swim`

@BH1SCW 感谢反馈。 特化的语法并未稳定,这个只有新版再说。