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). https://github.com/rust-lang/rust/issues/93838#issuecomment-1430524383
This commit is contained in:
Alan Wu 2023-02-14 18:31:49 -05:00
parent 86691a19e8
commit 021889f262
1 changed files with 6 additions and 1 deletions

View File

@ -89,10 +89,15 @@ m!(const _: () = (););
// const _: () = ();
```
Unnamed constants are always [evaluated][const_eval] at compile-time to surface
## Evaluation
[Free][free] constants are always [evaluated][const_eval] at compile-time to surface
panics. This happens even within an unused function:
```rust,compile_fail
// Compile-time panic
const PANIC: () = std::unimplemented!();
fn unused_generic_function<T>() {
// A failing compile-time assertion
const _: () = assert!(usize::BITS == 0);