Skip to content

Const-generic arguments are not printed in error messages #61395

Closed
@jplatte

Description

@jplatte

This code (playground):

#![feature(const_generics)]

struct Generic<const C: usize>;

fn main() {
    let _: Generic<0> = Generic::<1>;
}

results in

error[E0308]: mismatched types
 --> src/main.rs:6:25
  |
6 |     let _: Generic<0> = Generic::<1>;
  |                         ^^^^^^^^^^^^ expected `0usize`, found `1usize`
  |
  = note: expected type `Generic<>`
             found type `Generic<>`

with missing const arguments in the note: ... at the bottom.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-genericsArea: const generics (parameters and arguments)A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.F-const_generics`#![feature(const_generics)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.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