Error for `for let mut v = vec![]; v.push(v);` ‒ "error[E0275]: overflow assigning `Vec<_>` to `_`" ‒ seems poor
Open
Nobody has claimed this yet.
A-diagnostics
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Code
fn main() {
let mut v = vec![];
v.push(v);
}
Current output
error[E0275]: overflow assigning `Vec<_>` to `_`
--> src/main.rs:3:12
|
3 | v.push(v);
| ^
For more information about this error, try `rustc --explain E0275`.
Desired output
"Vec<_> would appear in its own signature"? "Self-referential type"? idk
Rationale and extra context
It feels really circumferential to render "type of v depends on itself" as "can't reify infinite-depth type deduction tree with finite stack". I think.
Other cases
Rust Version
$ rustc +nightly --version --verbose
rustc 1.93.0-nightly (cc3eee7fb 2025-11-28)
binary: rustc
commit-hash: cc3eee7fbe17ea4b7238531cb97e1b7b8bd6afce
commit-date: 2025-11-28
host: x86_64-unknown-linux-gnu
release: 1.93.0-nightly
LLVM version: 21.1.5
Anything else?
No response
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 reproducing the example in src/main.rs with the reported rustc nightly version and inspect how the E0275 diagnostic is produced. Compare the current overflow message with the requested self-referential-type explanation; done means the diagnostic clearly explains why v cannot contain itself and the existing reproduction is covered by an appropriate compiler test.
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
- 35/100