Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lcnr opened this issue May 7, 2024 · 3 comments
Closed

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

lcnr opened this issue May 7, 2024 · 3 comments

Comments

@lcnr
Copy link
Contributor

lcnr commented May 7, 2024

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

  • this tries to prove T: Trait<'a> either when checking for wf for coinduction(?), or currently in discard_impls_shadowed_by_env
    • two ParamEnv candidates, T: Trait<'a> and T::Assoc: Trait<'a>
      • T: Trait<'a> holds, but adds a region constraint due to uniquification
      • T::Assoc: Trait<'a> may hold if T::Assoc normalizes to T
        • this causes an inductive cycle
@compiler-errors
Copy link
Member

fixing this will probably fix #109

@lcnr
Copy link
Contributor Author

lcnr commented May 14, 2024

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
Copy link
Contributor Author

lcnr commented May 22, 2024

closing due to #114 (comment)

@lcnr lcnr closed this as completed May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants