Skip to content

Incomplete inference guidance due to Sized param-env clause causes method selection failure #137812

Open
@compiler-errors

Description

@compiler-errors

I tried this code:

trait Foo<T> {
    fn method();
}

fn test<T, U>()
where
    T: Foo<(i32,)>,
    (U,): Sized,
{
    <T as Foo<(_,)>>::method();
}

I expected to see it work (in the old solver).

Instead, it did not:

error[E0277]: the trait bound `T: Foo<(U,)>` is not satisfied
  --> src/lib.rs:10:6
   |
10 |     <T as Foo<(_,)>>::method();
   |      ^ the trait `Foo<(U,)>` is not implemented for `T`

Meta

stable 1.85 rust, beta rust, and nightly feb 28 2025

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-inferenceArea: Type inferenceA-trait-systemArea: Trait systemC-bugCategory: This is a bug.T-typesRelevant to the types team, which will review and decide on the PR/issue.fixed-by-next-solverFixed by the next-generation trait solver, `-Znext-solver`.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions