rust-lang / rust-lang/rust

out of memory

Open
#124,901 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug I-compilemem I-crash P-medium regression-from-stable-to-stable
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Unfortunately there is no kind of error or warning given by rustc, it just OOMs right away :/

I tried this code:

trait Default {
    type Id;

    fn intu(&self) -> &Self::Id;
}

impl<T: Default<Id = U>, U: Copy> Default for U {
    default type Id = T;
    fn intu(&self) -> &Self::Id {
        self
    }
}

fn specialization<T>(t: T) -> U {
    *t.intu()
}

use std::num::NonZero;

fn main() {
    let assert_eq = NonZero::<u8, Option<NonZero<u8>>>(0);
    assert_eq!(specialization, None);
}

I expected to see this happen: explanation

Instead, this happened: explanation

Meta

rustc --version --verbose:

rustc 1.80.0-nightly (faefc618c 2024-05-07)
binary: rustc
commit-hash: faefc618cf48bd794cbc808448df1bf3f59f36af
commit-date: 2024-05-07
host: x86_64-unknown-linux-gnu
release: 1.80.0-nightly
LLVM version: 18.1.4

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 supplied program with the reported rustc 1.80.0-nightly toolchain and reduce the example while preserving the out-of-memory behavior. No source file, test, expected result, or actual error output is identified, so completion would require locating the responsible compiler behavior and defining a regression test or other verified fix.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.