mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 10:45:18 +00:00
24 lines
412 B
Rust
24 lines
412 B
Rust
//@ build-fail
|
|
|
|
struct Bar<const BITS: usize>;
|
|
|
|
impl<const BITS: usize> Bar<BITS> {
|
|
const ASSERT: bool = {
|
|
let b = std::convert::identity(1);
|
|
["oops"][b]; //~ ERROR evaluation of `Bar::<0>::ASSERT` failed
|
|
true
|
|
};
|
|
|
|
fn assert() {
|
|
let val = Self::ASSERT;
|
|
if val {
|
|
std::convert::identity(val);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
fn main() {
|
|
Bar::<0>::assert();
|
|
}
|