We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 24c87f6 + 021889f commit ebab1cdCopy full SHA for ebab1cd
src/items/constant-items.md
@@ -89,6 +89,22 @@ m!(const _: () = (););
89
// const _: () = ();
90
```
91
92
+## Evaluation
93
+
94
+[Free][free] constants are always [evaluated][const_eval] at compile-time to surface
95
+panics. This happens even within an unused function:
96
97
+```rust,compile_fail
98
+// Compile-time panic
99
+const PANIC: () = std::unimplemented!();
100
101
+fn unused_generic_function<T>() {
102
+ // A failing compile-time assertion
103
+ const _: () = assert!(usize::BITS == 0);
104
+}
105
+```
106
107
+[const_eval]: ../const_eval.md
108
[associated constant]: ../items/associated-items.md#associated-constants
109
[constant value]: ../const_eval.md#constant-expressions
110
[free]: ../glossary.md#free-item
0 commit comments