rustc appears to hang on this RPITIT example
Author: 623637646Created Jul 10, 2026Updated Sep 28, 2026
LabelsA-trait-systemC-bugI-hangT-typesfixed-by-next-solver
I found a small example where rustc appear to hang during type checking.
pub struct BoundDropDisposal<D>(D);
pub trait Observable {
fn subscribe<OR>(self, observer: OR) -> BoundDropDisposal<impl Clone>;
}
fn test(source: impl Observable) {
subscribe_unsub_after_termination(|observer| {
source.subscribe(observer)
});
}
pub fn subscribe_unsub_after_termination<D, F>(_builder: F)
where
F: FnOnce(D) -> BoundDropDisposal<D>,
{
}Running this does not finish for me and keeps CPU busy:
timeout 10 rustc --crate-type lib lib.rsWith the next solver, it reports an error immediately:
rustc +nightly -Znext-solver=globally --crate-type lib lib.rserror[E0271]: type mismatch resolving `impl Clone == impl Clone`
--> lib.rs:9:26
|
9 | source.subscribe(observer)
| ^^^^^^^^ types differSo I expected the current solver to also terminate with a type error instead of continuing to run.
Toolchain:
rustc 1.97.0 (2d8144b78 2026-07-07)
binary: rustc
commit-hash: 2d8144b7880597b6e6d3dfd63a9a9efae3f533d3
commit-date: 2026-07-07
host: aarch64-apple-darwin
release: 1.97.0
LLVM version: 22.1.6Source: rust-lang/rust