Skip to content

out of memory #124901

Open
Open
@matthiaskrgr

Description

@matthiaskrgr

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-compilememIssue: Problems and improvements with respect to memory usage during compilation.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.P-mediumMedium priorityregression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions