Closed agausmann closed 3 years ago
(WIP, did a more thorough search and missed some impls)
I'm surprised Rust lets you do this, honestly. You are implementing From
, which is a foreign trait for this crate, for stuff like std
or mint
types, which are also foreign for this crate. Why does it let you do this?
Because the signature of the impl is more than just the trait and the type you are implementing.
In impl ForeignTrait<LocalType> for ForeignType
- the presence of the LocalType
in the trait's generic parameter is also considered when evaluating orphan rules.
I do wonder if this is something that changed in Rust recently (in recent years, that is). It's nice that it works though :)
Fixes missing impls of
impl From<ArrayN> for ForeignType
which is currently provided asimpl Into<ForeignType> for ArrayN
From the
std::convert::Into
documentation:While it isn't very significant, as you can write
cgmath_vector.into()
in most places, it makes code cleaner where type inference is not possible (e.g.format!
macros):(Example adapted from this real code snippet that I had to write)