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 b9ccb09 commit 2e15db6Copy full SHA for 2e15db6
src/items/constant-items.md
@@ -89,6 +89,18 @@ m!(const _: () = (););
89
// const _: () = ();
90
```
91
92
+Unnamed constants are always [evaluated][const_eval] at compile-time to surface
93
+panics. They are evaluated at compile-time even when placed within
94
+an unused function:
95
+
96
+```rust,compile_fail
97
+fn unused_generic_function<T>() {
98
+ // A failing compile-time assertion
99
+ const _: () = assert!(usize::BITS == 0);
100
+}
101
+```
102
103
+[const_eval]: ../const_eval.md
104
[associated constant]: ../items/associated-items.md#associated-constants
105
[constant value]: ../const_eval.md#constant-expressions
106
[free]: ../glossary.md#free-item
0 commit comments