]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/remove-never-const.rs
Auto merge of #83314 - Aaron1011:print-unstable-value, r=lcnr
[rust.git] / src / test / mir-opt / remove-never-const.rs
1 // This was originally a regression test for #66975 - ensure that we do not generate never typed
2 // consts in codegen. We also have tests for this that catches the error, see
3 // src/test/ui/consts/const-eval/index-out-of-bounds-never-type.rs.
4
5 // Force generation of optimized mir for functions that do not reach codegen.
6 // compile-flags: --emit mir,link
7
8 #![feature(const_panic)]
9 #![feature(never_type)]
10 #![warn(const_err)]
11
12 struct PrintName<T>(T);
13
14 impl<T> PrintName<T> {
15     const VOID: ! = panic!();
16 }
17
18 // EMIT_MIR remove_never_const.no_codegen.PreCodegen.after.mir
19 fn no_codegen<T>() {
20     let _ = PrintName::<T>::VOID;
21 }
22
23 fn main() {}