Skip to content

ICE: rustc crashed on const generics #61341

Closed
@qwerty19106

Description

@qwerty19106

Test code:

#![feature(const_generics)]

use std::mem::MaybeUninit;

#[repr(transparent)]
pub struct OsThreadStack<const N: usize>(MaybeUninit<[u64; N]>);

fn main() {

}

It produced error:

error: internal compiler error: src/librustc/ty/sty.rs:2311: expected constant usize, got Const {
    ty: usize,
    val: Param(
        N/#0,
    ),
}

Playground version: rustc 1.37.0-nightly (2019-05-29 37d001e)

playground

Metadata

Metadata

Assignees

Labels

A-const-genericsArea: const generics (parameters and arguments)I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions