about summary refs log tree commit diff
path: root/src/tools/miri/tests/fail/erroneous_const.rs
blob: 6e126ed701f88d08409ee96457ebbd73eade11fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Make sure we detect erroneous constants post-monomorphization even when they are unused.
//! (https://github.com/rust-lang/miri/issues/1382)
#![feature(never_type)]

struct PrintName<T>(T);
impl<T> PrintName<T> {
    const VOID: ! = panic!(); //~ERROR: explicit panic
}

fn no_codegen<T>() {
    if false {
        let _ = PrintName::<T>::VOID; //~NOTE: constant
    }
}
fn main() {
    no_codegen::<i32>();
}