rust-lang / trait-system-refactor-initiative

The Rustc Trait System Refactor Initiative
21 stars 0 forks source link

ambiguity due to "maybe-rigid" rigid assoc type #111

Closed lcnr closed 5 months ago

lcnr commented 5 months ago
trait Trait<'a> {
    type Assoc;
}

trait Outer<'a>{}

impl<'a, T: ?Sized> Outer<'a> for T
where
    T: Trait<'a>,
    T::Assoc: Trait<'a>,
{}

checking T::Assoc: Trait<'a>, we try to normalize the self type

compiler-errors commented 5 months ago

fixing this will probably fix #109

lcnr commented 5 months ago

this does not affect a test which uses an impl as indirection, as we prefer param env candidates over impls

trait IntoIterator<'a> {
    type IntoIter;
}

trait Iterator<'a> {}
impl<'a, T: Iterator<'a>> IntoIterator<'a> for T {
    type IntoIter = T;
}

trait Outer<'a>{}

impl<'a, T: ?Sized> Outer<'a> for T
where
    T: IntoIterator<'a>,
    T::IntoIter: Iterator<'a>,
{}
lcnr commented 5 months ago

closing due to https://github.com/rust-lang/trait-system-refactor-initiative/issues/114#issuecomment-2123832503