Compiler hang: infinite type expansion for trait impl with recursive double-reference bound (`&'a &'a T`)
Open
@TaKO8Ki is already working on this.
Since Feb 3, 2026.
A-coherence
C-bug
I-hang
S-has-mcve
T-compiler
T-types
WG-trait-system-refactor
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.2k
- PR merge metrics
- PR metrics pending
Description
I encountered a compiler hang when compiling a code snippet with a recursive trait implementation involving double references.
Instead of hitting the recursion_limit or reporting a conflicting implementation error, the compiler continues to consume memory. Maybe related to #151632
trait UseRef {}
impl<T> UseRef for T {}
impl<'a, T> UseRef for & T
where
T: UseRef,
&'a &'a T: UseRef,
{}
fn main(){}
Meta
rustc --version --verbose:
rustc 1.93.0 (254b59607 2026-01-19)
binary: rustc
commit-hash: 254b59607d4417e9dffbc307138ae5c86280fe4c
commit-date: 2026-01-19
host: x86_64-unknown-linux-gnu
release: 1.93.0
LLVM version: 21.1.8
Backtrace
<backtrace>
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.