Conflicting implementations of trait in Rust

The fact that &'a str does not implement Into<i32> is not taken into account, because there is no guarantee that it couldn’t be added later. This would then break your code.

So if this were allowed the possible breakage would make it harder to add implementations to library traits.

Unfortunately I couldn’t find documentation for that, neither in The Rust Programming Language Book nor in the Reference Manual.

The best I could find is RFC 1023, which says that a crate […] cannot rely that Type: !Trait holds unless Type or Trait is local.

Leave a Comment