Skip to content

New solver type mismatch #20555

@ChayimFriedman2

Description

@ChayimFriedman2

This code causes a type mismatch:

trait Iterator {
    type Item;

    fn partition<F>(&self, f: F)
    where
        F: FnMut(&Self::Item) -> bool,
    {
    }
}

struct Iter;
impl Iterator for Iter {
    type Item = i32;
}

fn main() {
    Iter.partition(|n| true);
}

It shows expected {closure#641024}, found {closure#641024}, which is quite confusing. The reason is they differ in their substitutions.

I know the cause and fixed it locally but it causes another bug, see #t-compiler/rust-analyzer > Chalk inference table @ 💬. Opening this issue just so we can track this.

CC #20548 - the bugs could be related.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-new-solverBugs from the new solver migration - should be fixed before stable releaseA-tytype system / type inference / traits / method resolutionC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions