Skip to content

Hang in custom Vec #148653

@ym-xie

Description

@ym-xie

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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-hangIssue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-typesRelevant to the types team, which will review and decide on the PR/issue.fixed-by-next-solverFixed by the next-generation trait solver, `-Znext-solver`.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions