Skip to content
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

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

Open
compiler-errors opened this issue Feb 28, 2025 · 1 comment
Labels
A-inference Area: Type inference A-trait-system Area: Trait system C-bug Category: This is a bug. fixed-by-next-solver Fixed by the next-generation trait solver, `-Znext-solver`.

Comments

@compiler-errors
Copy link
Member

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

@compiler-errors compiler-errors added the C-bug Category: This is a bug. label Feb 28, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 28, 2025
@compiler-errors
Copy link
Member Author

We already probably have a duplicate for this but I wanted to be able to cross-link something.

@compiler-errors compiler-errors added A-trait-system Area: Trait system A-inference Area: Type inference fixed-by-next-solver Fixed by the next-generation trait solver, `-Znext-solver`. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-inference Area: Type inference A-trait-system Area: Trait system C-bug Category: This is a bug. fixed-by-next-solver Fixed by the next-generation trait solver, `-Znext-solver`.
Projects
None yet
Development

No branches or pull requests

2 participants