rust-lang / rust-lang/rust

Hang in custom Vec

Open
#148,653 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug fixed-by-next-solver I-hang needs-triage S-has-mcve T-types
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I tried this code:

struct Array<T> {
    data: Vec<T>
}
fn sum_arrays<T>(first: Array<T>) -> Array<T> {
    let mut result = Array {data: first.data.clone()};
    result.data.push(8);
    result
}
struct Vec<T> {data: Vec<T> }
impl<T> Vec<T> {
    pub fn push(mut self: &mut Self, object: &T) -> &mut Self {
        self
    }
}

Command: timeout 30s rustc file.rs

It did not finish within 30 seconds.

Meta

rustc --version --verbose:

rustc 1.93.0-nightly (c90bcb957 2025-11-06)
binary: rustc
commit-hash: c90bcb9571b7aab0d8beaa2ce8a998ffaf079d38
commit-date: 2025-11-06
host: aarch64-apple-darwin
release: 1.93.0-nightly
LLVM version: 21.1.3
Backtrace

<no backtrace>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the hang with the provided code and timeout 30s rustc file.rs, using the reported nightly toolchain details as context. Investigate compiler behavior triggered by the custom Vec<T>::push signature and confirm that the minimal program finishes compiling; preserve the example as a regression case if the project’s compiler tests provide a suitable location.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.