Skip to content

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

Open
@lcnr

Description

@lcnr
// 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions