Repository navigation
rustc after 1.91 hangs during type inference case #159750
Copy link
Copy link
Closed
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.A-inferenceArea: Type inferenceArea: Type inferenceA-method-lookupArea: Method lookup (typeck, post `rustc_resolve`, not to be confused with `A-resolve`)Area: Method lookup (typeck, post `rustc_resolve`, not to be confused with `A-resolve`)A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant 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`.Fixed by the next-generation trait solver, `-Znext-solver`.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Description
If there's any more information I can give, I'm happy to investigate! Sorry for the length of the reproduction, I couldn't find anything shorter.
Code
I tried this code:
use std::marker::PhantomData;
pub trait Marker {}
impl Marker for () {}
pub trait Relation {
type Domain: Marker;
type Codomain: Marker;
}
pub trait Follow<R: Relation, E: Marker, const DIR: bool> {}
impl<R: Relation> Follow<R, R::Codomain, true> for R::Domain {}
impl<R: Relation> Follow<R, R::Domain, false> for R::Codomain {}
// this bound on T is somehow important?
pub trait Container<T: Marker>: IntoIterator<Item = T> {
type WithReplacedMarker<N: Marker>: Container<N>;
type IDContainer;
}
impl<T: Marker> Container<T> for Option<T> {
type WithReplacedMarker<N: Marker> = Option<N>;
type IDContainer = Option<()>;
}
struct StubQueryable<E: Marker, C: Container<E>>(PhantomData<(E, C)>);
impl<E: Marker, C: Container<E>> Queryable for StubQueryable<E, C> {
type Output = E;
type Container = C;
}
pub trait Queryable {
type Output: Marker;
type Container: Container<Self::Output>;
fn finish(&self) -> <Self::Container as Container<Self::Output>>::IDContainer {
todo!()
}
fn follow<R: Relation, E: Marker, const DIR: bool>(
&self,
_r: &R,
) -> impl Queryable<Output = E, Container = Option<E>> {
StubQueryable::<E, Option<E>>(PhantomData)
}
}
struct R;
impl Relation for R {
type Domain = ();
type Codomain = ();
}
fn run_on(q: &impl Queryable<Output = (), Container = Option<()>>) {
// this line causes rustc to hang:
q.follow(&R).finish();
}I expected to see this happen: Compile error due to inability to determine the value of the DIR generic parameter.
Instead, this happened: rustc hangs in a presumably-infinite loop (at least 60 seconds instead of 40ms)
Version it worked on
It most recently worked on: 1.91.0
Version with regression
rustc --version --verbose:
rustc 1.92.0 (ded5c06cf 2025-12-08)
binary: rustc
commit-hash: ded5c06cf21d2b93bffd5d884aa6e96934ee4234
commit-date: 2025-12-08
host: x86_64-unknown-linux-gnu
release: 1.92.0
LLVM version: 21.1.3
(The same happens for 1.94, 1.96-nightly, 1.97, and 1.99-nightly.)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.A-inferenceArea: Type inferenceArea: Type inferenceA-method-lookupArea: Method lookup (typeck, post `rustc_resolve`, not to be confused with `A-resolve`)Area: Method lookup (typeck, post `rustc_resolve`, not to be confused with `A-resolve`)A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant 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`.Fixed by the next-generation trait solver, `-Znext-solver`.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Activity
InvalidPathException commentedon Jul 23, 2026
-Znext-solver=globallyfixes thisreduced
@rustbot claim
InvalidPathException commentedon Jul 23, 2026
seems like duplicate for #157516
InvalidPathException commentedon Jul 23, 2026
Found that the regression was introduced by #142712, kind of subtle...
Rollup merge of rust-lang#159774 - InvalidPathException:fix-old-solve…
Rollup merge of rust-lang#159774 - InvalidPathException:fix-old-solve…
Rollup merge of rust-lang#159774 - InvalidPathException:fix-old-solve…
Rollup merge of rust-lang#159774 - InvalidPathException:fix-old-solve…
Unrolled build for #159774
ojeda commentedon Jul 27, 2026
@InvalidPathException Was #159774 intended to close this one too?
apiraino commentedon Jul 27, 2026
Closed by #159774
Rollup merge of #159774 - InvalidPathException:fix-old-solver-hang, r…
Rollup merge of #159774 - InvalidPathException:fix-old-solver-hang, r…