Skip to content

ICE: "non-Scalar ConstValue encountered in super_relate_consts" with const generics #62579

Closed
@Aaron1011

Description

@Aaron1011

The following code:

#![feature(const_generics)]
struct NoMatch;

fn foo<const T: NoMatch>() -> bool {
    return true
}

fn main() {
    foo::<{NoMatch}>();
}

Produces an ICE:

error: internal compiler error: src/librustc/ty/relate.rs:598: non-Scalar ConstValue encountered in super_relate_consts Const { ty: NoMatch, val: ByRef { align: Align { pow2: 0 }, offset: Size { raw: 0 }, alloc: Allocation { bytes: [], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [], len: Size { raw: 0 } }, align: Align { pow2: 0 }, mutability: Immutable, extra: () } } } Const { ty: NoMatch, val: ByRef { align: Align { pow2: 0 }, offset: Size { raw: 0 }, alloc: Allocation { bytes: [], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [], len: Size { raw: 0 } }, align: Align { pow2: 0 }, mutability: Immutable, extra: () } } }

Metadata

Metadata

Assignees

Labels

A-const-genericsArea: const generics (parameters and arguments)C-bugCategory: This is a bug.F-const_generics`#![feature(const_generics)]`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.glacierICE tracked in rust-lang/glacier.requires-nightlyThis issue requires a nightly compiler in some way.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions