Skip to content

Commit f5faaf8

Browse files
Adjust language to also cover named constants
Especially since it seems that there is no test in rust-lang/rust that covers the unamed constant case (even though the implementation covers it). rust-lang/rust#93838 (comment)
1 parent 8bbcd10 commit f5faaf8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/items/constant-items.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,15 @@ m!(const _: () = (););
8989
// const _: () = ();
9090
```
9191

92-
Unnamed constants are always [evaluated][const_eval] at compile-time to surface
92+
## Evaluation
93+
94+
[Free][free] constants are always [evaluated][const_eval] at compile-time to surface
9395
panics. This happens even within an unused function:
9496

9597
```rust,compile_fail
98+
// Compile-time panic
99+
const PANIC: () = std::unimplemented!();
100+
96101
fn unused_generic_function<T>() {
97102
// A failing compile-time assertion
98103
const _: () = assert!(usize::BITS == 0);

0 commit comments

Comments
 (0)