Ambiguity in assemble_candidates_after_normalizing_self_ty
causes coherence error · Issue #52 · rust-lang/trait-system-refactor-initiative (original) (raw)
This coherence failure...
pub(crate) trait Drive {}
trait DerefAndDrive {}
impl Drive for T where T: 'static, for<'a> &'a T: IntoIterator, for<'a> <&'a T as IntoIterator>::Item: DerefAndDrive, { }
impl Drive for () {}
fn main() {}
... is because the goal <&'a () as IntoIterator>::Item: DerefAndDrive
is considered ambiguous when unifying the two impls above. That's because we try normalizing the self type of the goal, and &'a (): IntoIterator
is treated as unknowable.
I think this is problematic, because even if we were to add an upstream implementation to be able to normalize <&'a () as IntoIterator>::Item
, it couldn't implement DerefAndDrive
since that's a trait local to the crate.