Closed
Description
A combination of specialization and an associated type yields this error. Removing the Error
associated type and replacing all uses with a concrete type removes the error:
#![feature(specialization)]
trait Deserializer {
type Error;
fn deserialize_bytes<V: Visitor>(self, visitor: V) -> Result<V::Value, Self::Error>;
fn deserialize<V: Visitor>(self, visitor: V) -> Result<V::Value, Self::Error>;
}
trait Visitor {
type Value;
type Error;
fn visit_bytes(self, &[u8]) -> Result<Self::Value, Self::Error>;
}
impl<'a, T> Deserializer for &'a [T] {
type Error = ();
default fn deserialize_bytes<V: Visitor>(self, visitor: V) -> Result<V::Value, Self::Error> {
self.deserialize(visitor)
}
fn deserialize<V: Visitor>(self, visitor: V) -> Result<V::Value, Self::Error> {
unimplemented!()
}
}
impl<'a> Deserializer for &'a [u8] {
fn deserialize_bytes<V: Visitor>(self, visitor: V) -> Result<V::Value, Self::Error> {
visitor.visit_bytes(self)
}
}
fn main() {}
this occurs on the playground nightly