]> git.lizzy.rs Git - rust.git/blob - src/tools/miri/tests/fail/erroneous_const.rs
Auto merge of #101969 - reez12g:issue-101306, r=reez12g
[rust.git] / src / tools / miri / tests / fail / erroneous_const.rs
1 //! Make sure we detect erroneous constants post-monomorphization even when they are unused.
2 //! (https://github.com/rust-lang/miri/issues/1382)
3 // Inlining changes the error location
4 //@compile-flags: -Zmir-opt-level=0
5 #![feature(never_type)]
6 #![warn(warnings, const_err)]
7
8 struct PrintName<T>(T);
9 impl<T> PrintName<T> {
10     const VOID: ! = panic!(); //~ERROR: evaluation of `PrintName::<i32>::VOID` failed
11 }
12
13 fn no_codegen<T>() {
14     if false {
15         let _ = PrintName::<T>::VOID; //~ERROR: post-monomorphization error
16     }
17 }
18 fn main() {
19     no_codegen::<i32>();
20 }