We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 52c7b8e commit ff136bdCopy full SHA for ff136bd
tests/compile-fail/erroneous_const.rs
@@ -0,0 +1,19 @@
1
+//! Make sure we detect erroneous constants post-monomorphization even when they are unused.
2
+//! (https://github.com/rust-lang/miri/issues/1382)
3
+#![feature(const_panic)]
4
+#![feature(never_type)]
5
+#![warn(const_err)]
6
+
7
+struct PrintName<T>(T);
8
+impl<T> PrintName<T> {
9
+ const VOID: ! = panic!(); //~WARN any use of this value will cause an error
10
+}
11
12
+fn no_codegen<T>() {
13
+ if false {
14
+ let _ = PrintName::<T>::VOID; //~ERROR referenced constant has errors
15
+ }
16
17
+fn main() {
18
+ no_codegen::<i32>();
19
0 commit comments