Compiler hang due to field-representing types defining a struct in terms of itself.
Open
Nobody has claimed this yet.
C-bug
F-field_projections
I-hang
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
The following code causes rustc to hang, instead of emitting a normal compiler error:
#![feature(field_projections)]
#![expect(incomplete_features)]
use std::field::{Field, field_of};
pub struct Weird<T>(<field_of!(Weird<Option<T>>, 0) as Field>::Type);
Meta
rustc --version --verbose:
rustc 1.96.0-nightly (38c0de8dc 2026-02-28)
binary: rustc
commit-hash: 38c0de8dcb14d42290042521be9958d37f3fa390
commit-date: 2026-02-28
host: x86_64-pc-windows-msvc
release: 1.96.0-nightly
LLVM version: 22.1.0
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.
Research direction
Start by compiling the provided minimal Rust program with the reported nightly rustc version and confirm that it hangs. Trace the compiler handling of field_projections and the recursive field-representing type; done means rustc terminates and emits a normal compiler error for this input.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100