2020-08-10 02:04:37 -05:00
|
|
|
//! Make sure we detect erroneous constants post-monomorphization even when they are unused.
|
|
|
|
//! (https://github.com/rust-lang/miri/issues/1382)
|
2021-01-26 04:48:11 -06:00
|
|
|
// Inlining changes the error location
|
2022-07-08 11:08:32 -05:00
|
|
|
//@compile-flags: -Zmir-opt-level=0
|
2020-08-10 02:04:37 -05:00
|
|
|
#![feature(never_type)]
|
|
|
|
#![warn(warnings, const_err)]
|
|
|
|
|
|
|
|
struct PrintName<T>(T);
|
|
|
|
impl<T> PrintName<T> {
|
2022-07-11 06:44:55 -05:00
|
|
|
const VOID: ! = panic!(); //~ERROR: evaluation of `PrintName::<i32>::VOID` failed
|
2020-08-10 02:04:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn no_codegen<T>() {
|
|
|
|
if false {
|
2022-07-11 06:44:55 -05:00
|
|
|
let _ = PrintName::<T>::VOID; //~ERROR: post-monomorphization error
|
2020-08-10 02:04:37 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
fn main() {
|
|
|
|
no_codegen::<i32>();
|
|
|
|
}
|