Problems when implements trait for trait
⚓ Rust 📅 2025-07-01 👤 surdeus 👁️ 15String : !Copy, but if I impl<F: Copy> X for F, then I can't impl X for String, because
upstream crates may add a new impl of trait
std::marker::Copyfor typestd::string::Stringin future versions
That is ridiculous, if that will happen in the future, refuses the code at that time, why refuses it now.
How can I get through this
trait X {
fn callx(&self);
}
impl<F: Copy> X for F {
fn callx(&self) {
println!("Copy");
}
}
impl X for String {
fn callx(&self) {
println!("String");
}
}
fn main() {}
2 posts - 2 participants
🏷️ rust_feed