We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b9ccb09 commit 86691a1Copy full SHA for 86691a1
src/items/constant-items.md
@@ -89,6 +89,17 @@ m!(const _: () = (););
89
// const _: () = ();
90
```
91
92
+Unnamed constants are always [evaluated][const_eval] at compile-time to surface
93
+panics. This happens even within an unused function:
94
+
95
+```rust,compile_fail
96
+fn unused_generic_function<T>() {
97
+ // A failing compile-time assertion
98
+ const _: () = assert!(usize::BITS == 0);
99
+}
100
+```
101
102
+[const_eval]: ../const_eval.md
103
[associated constant]: ../items/associated-items.md#associated-constants
104
[constant value]: ../const_eval.md#constant-expressions
105
[free]: ../glossary.md#free-item
0 commit comments