]> git.lizzy.rs Git - rust.git/blob - tests/mir-opt/remove_never_const.rs
Auto merge of #107644 - Zoxc:query-cache-tweak, r=cjgillot
[rust.git] / tests / 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 // tests/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(never_type)]
9
10 struct PrintName<T>(T);
11
12 impl<T> PrintName<T> {
13     const VOID: ! = panic!();
14 }
15
16 // EMIT_MIR remove_never_const.no_codegen.PreCodegen.after.mir
17 fn no_codegen<T>() {
18     let _ = PrintName::<T>::VOID;
19 }
20
21 fn main() {}