- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
#![feature(nonzero, const_fn)]
extern crate core;
mod a {
    use core::nonzero::NonZero;
    #[derive(Eq, PartialEq)]
    pub struct Foo {
        bar: NonZero<u64>,  // Private
    }
    pub const FOO: Foo = Foo {
        bar: unsafe { NonZero::new(2) },
    };
}
fn main() {
    assert!(a::FOO == a::FOO);
    assert!(match a::FOO {
        a::FOO => true,
        _ => false,
    });
}rustc 1.19.0-nightly (d3abc80 2017-05-09)
error[E0080]: constant evaluation error
   |
note: for pattern here
  --> a.rs:21:9
   |
21 |         a::FOO => true,
   |         ^^^^^^
error: aborting due to previous errorThe error message doesn’t say what’s wrong with this pattern. Based on code in src/librustc/middle/const_val.rs it looks like more info should be printed, with ConstEvalErr::description.
CC @eddyb
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.