next-solver proves higher-ranked supertrait bound with GAT that the old solver hits cycle on

Abierto
#166,043 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
rust
Área
compilers

Línea de trabajo

Start by reading the Func and HigherFunc definitions and the blanket impl in the issue’s reproducer; compare how the old and next trait solvers handle the higher-ranked GAT supertrait bound. The old solver reports an overflow while the next solver compiles, and the issue asks whether that difference is expected. Done means determining the intended behavior and addressing the solver mismatch.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

A-GATs A-higher-ranked C-bug needs-triage T-types WG-trait-system-refactor

Randomly hit this while working on some higher-ranked lifetime branding stuff.

pub trait Func<'a> {
    type Ret;
}
pub trait Inst {}

pub trait HigherFunc: for<'a> Func<'a, Ret = Self::RetInst<'a>> {
    type RetInst<'a>: Inst;
}
impl<T> HigherFunc for T
where
    T: for<'a> Func<'a, Ret: Inst>,
{
    type RetInst<'a> = <T as Func<'a>>::Ret;
}

next-solver: Compiles successfully
old solver:

error[E0275]: overflow evaluating the requirement `Self: HigherFunc`
  --> src/main.rs:6:1
   |
 6 | pub trait HigherFunc: for<'a> Func<'a, Ret = Self::RetInst<'a>> {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`playground`)
note: required for `Self` to implement `HigherFunc`
  --> src/main.rs:9:9
   |
 9 | impl<T> HigherFunc for T
   |         ^^^^^^^^^^     ^
10 | where
11 |     T: for<'a> Func<'a, Ret: Inst>,
   |                              ---- unsatisfied trait bound introduced here
   = note: 63 redundant requirements hidden
   = note: required for `Self` to implement `HigherFunc`

I think the old solver is getting stuck checking the supertrait bound for the impl.

I'm not sure if next-solver is supposed to allow this code, since I believe there is a sensible proof here, and this does work for non-higher-ranked variants on both solvers, but it is a mismatch in behavior nonetheless.

Meta

rustc --version --verbose:

rustc 1.100.0 (0ef1bc386 2026-11-09)
binary: rustc
commit-hash: 0ef1bc386059596dada8fb65b50425aab2ea637a
commit-date: 2026-11-09
host: x86_64-unknown-linux-gnu
release: 1.100.0
LLVM version: 23.1.5

and

rustc 1.102.0-nightly (5f4effd57 2026-11-13)
binary: rustc
commit-hash: 5f4effd579500175af844241eb179e756190f1e7
commit-date: 2026-11-13
host: x86_64-unknown-linux-gnu
release: 1.102.0-nightly
LLVM version: 23.1.5

same behavior for old-solver on stable and on nightly with next-solver=coherence

Lenguaje dominante
Rust
Estrellas
122k
Forks
16.7k
Merge medio
2 d 16 h
PR fusionados (30 d)
515

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de rust-lang/rust

Todos los issues de rust-lang/rust

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.