Skip to content

removing eager infer var replacement improves type inference #81

Closed
@lcnr

Description

@lcnr

the following test compiles with the new solver, but not with the old one. This now works because we don't do eager infer var replacement and use deferred projection equality.

trait Id {
    type Assoc;
}

impl<T> Id for T {
    type Assoc = T;
}

trait Trait<T> {}
impl Trait<u32> for Vec<u32> {}
impl Trait<i32> for Vec<u32> {}

fn assoc_pair<T: Id>() -> Option<*mut (Vec<T>, T::Assoc)> {
    None
}

fn impls_trait<T: Trait<U>, U>(_: Option<*mut (T, U)>) {}

fn main() {
    impls_trait(assoc_pair());
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions