lcnr / solver-woes

Documenting changes due to the the new trait solver and my worries about stabilization
4 stars 0 forks source link

using impls with higher ranked projections not normalizeable before matching the impl header #7

Closed lcnr closed 1 year ago

lcnr commented 1 year ago
trait Trait {}

trait OtherTrait {
    type Assoc<'a>;
}

impl<T: OtherTrait> Trait for (T, for<'a> fn(<T as OtherTrait>::Assoc<'a>)) {}

impl OtherTrait for u32 {
    type Assoc<'a> = &'a u32;
}

fn impls<T: Trait>() {}

fn main() {
    impls::<(u32, for<'a> fn(&'a u32))>();
}

This does not work with the old solver but will compile with the new solver.

This means that https://github.com/rust-lang/rust/issues/105787 will end up being exploitable with the new solver though, so we may want to fix that first :shrug:

lcnr commented 1 year ago

opened https://github.com/rust-lang/trait-system-refactor-initiative/issues/9