Skip to content

"constant evaluation error" points to nothing when crossing the crate boundary #38875

@shepmaster

Description

@shepmaster

These error markers point to nothing, which is less than ideal. The note does at least help somewhat.

error[E0080]: constant evaluation error
 --> src/lib.rs:5:30
  |
5 |
  |                              ^^^^^^^^^^^ unimplemented constant expression: enum variants
  |
note: for repeat count here
 --> examples/main.rs:4:22
  |
4 |     let test_x = [0; constenum::CRATE_ONE];
  |                      ^^^^^^^^^^^^^^^^^^^^

src/lib.rs

pub enum MyEnum {
    ONE = 1,
}

pub const CRATE_ONE: usize = MyEnum::ONE as usize;

examples/main.rs

extern crate constenum;

fn main() {
    let test_x = [0; constenum::CRATE_ONE];
}

Execute via cargo build --example=main

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions