When I compile my crate with #[feature(specialization)]
, I get a warning that specialization is unsound, and that I should consider using #[feature(min_specialization)]
instead.
But I can't find any information whatsoever on how to use it. The tracking issue for specialization links to the PR where min_specialization was implemented, and that PR has an example.
But when I try to compile that example myself, I get the standard "conflicting implementation" message.
Example lib.rs, pulled more or less directly from the PR:
#[feature(min_specialization)]
trait TestTrait<T> {}
impl<T, I: Iterator<Item=T>> TestTrait<T> for I { /* default impl */ }
impl<T> TestTrait<T> for std::vec::IntoIter<T> { /* specialized impl */ }
Error:
error[E0119]: conflicting implementations of trait `TestTrait<_>` for type `std::vec::IntoIter<_>`:
--> src\lib.rs:8:1
|
7 | impl<T, I: Iterator<Item=T>> TestTrait<T> for I { /* default impl */ }
| ----------------------------------------------- first implementation here
8 | impl<T> TestTrait<T> for std::vec::IntoIter<T> { /* specialized impl */ }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::vec::IntoIter<_>`
Is there something obvious I'm missing here? Is there some documentation I can't find? If not, why does the compiler recommend that I use an undocumented feature?