Skip to content

Uninferred types/regions ICE for array impl with const generics #60744

Closed
@varkor

Description

@varkor

After #60742 is merged, the following produces:

#![feature(const_generics)]

use std::fmt;

struct Array<T, const N: usize>([T; N]);

impl<T: fmt::Debug, const N: usize> fmt::Debug for Array<T, {N}> {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        f.debug_list().entries(self.0.iter()).finish()
    }
}

fn main() {
    println!("{:?}", Array([1, 2, 3]));
}

results in:

error: internal compiler error: src/librustc/traits/codegen/mod.rs:160: Uninferred types/regions in `VtableImplData(impl_def_id=DefId(0:19 ~ bug[317d]::{{impl}}[0]), substs=[i32, Const { ty: usize, val: Infer(Var(_#0c)) }], nested=[(), ()])`

(Before #60742, this resulted in a different ICE.)

Metadata

Metadata

Assignees

No one assigned

    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