Skip to content

evaluation error hides "impl item missing" error #98629

Closed
@lcnr

Description

@lcnr
trait Trait {
    const N: usize;
}

impl Trait for i32 {}

fn f()
where
    [(); <i32 as Trait>::N]:,
{}

fn main() {}

results in

error[[E0080]](https://doc.rust-lang.org/nightly/error-index.html#E0080): evaluation of constant value failed
 --> src/main.rs:9:10
  |
9 |     [(); <i32 as Trait>::N]:,
  |          ^^^^^^^^^^^^^^^^^ referenced constant has errors

without showing that N is missing in the trait impl.

Taken from the comment by @carado in #74713 (comment)

Metadata

Metadata

Assignees

Labels

A-const-genericsArea: const generics (parameters and arguments)A-diagnosticsArea: Messages for errors, warnings, and lintsP-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions