ZhangHanDong / tao-of-rust-codes

《Rust编程之道》随书源码
https://ruststudy.github.io/tao_of_rust_docs/tao_of_rust/
MIT License
1.18k stars 170 forks source link

cannot specialize default item `swim` #331

Closed BH1SCW closed 2 years ago

BH1SCW commented 2 years ago

页码与行数

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`
ZhangHanDong commented 2 years ago

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