Closed compiler-errors closed 4 months ago
I don't think we want to add any reasoning like this :thinking: at least if we can avoid it. It feels quite subtle to get right and complicates our rules.
The general pattern here is allowed because of an unsoundness in the old solver, see https://github.com/rust-lang/rust/issues/114061. If we care about not breaking the affected crate we should instead add a negative impl to core and rely on negative coherence to get for<'a> &'a T: IntoIterator
to fail.
opened https://github.com/nikis05/derive-visitor/issues/16, closing
This coherence failure...
... 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 implementDerefAndDrive
since that's a trait local to the crate.