]> git.proxmox.com Git - rustc.git/blob - tests/mir-opt/remove_never_const.rs
New upstream version 1.75.0+dfsg1
[rustc.git] / tests / mir-opt / remove_never_const.rs
1 // skip-filecheck
2 // This was originally a regression test for #66975 - ensure that we do not generate never typed
3 // consts in codegen. We also have tests for this that catches the error, see
4 // tests/ui/consts/const-eval/index-out-of-bounds-never-type.rs.
5
6 // Force generation of optimized mir for functions that do not reach codegen.
7 // compile-flags: --emit mir,link
8
9 #![feature(never_type)]
10
11 struct PrintName<T>(T);
12
13 impl<T> PrintName<T> {
14 const VOID: ! = panic!();
15 }
16
17 // EMIT_MIR remove_never_const.no_codegen.PreCodegen.after.mir
18 fn no_codegen<T>() {
19 let _ = PrintName::<T>::VOID;
20 }
21
22 fn main() {}