Skip to content

non-defining use in defining scope: projection goal with nested item bound #69

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

Open
lcnr opened this issue Oct 10, 2023 · 1 comment
Open

Comments

@lcnr
Copy link
Contributor

lcnr commented Oct 10, 2023

// passes with old impl, ambiguous with the new one.
#![feature(type_alias_impl_trait)]
trait Trait {
    type Assoc;
}
impl<T: Copy> Trait for T {
    type Assoc = T;
}
fn needs_trait<T: Trait<Assoc = U>, U>() {}

type Tait = impl Copy;

fn define() -> Tait {}

fn check() {
    needs_trait::<Tait, Tait>();
    //[new]~^ ERROR type annotations needed
    //[new]~| NOTE cannot satisfy `<Tait as Trait>::Assoc == Tait`
}

fn main() {}

there are two candidates to prove <Tait as Trait>::Assoc = Tait:

  • impl candidate
  • ambig self infer type from trying to define the opaque

because it's a projection goal, we try to constrain the inference variable of the term, so we're unable to make progress and end up with ambiguity.

@lcnr
Copy link
Contributor Author

lcnr commented Oct 7, 2024

resolved by rust-lang/rust#117861, needs test

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

1 participant