Const assert is not evaluated in const generic unless used

Given the following code: Rust Playground

It seems that the const assert is not evaluated, and does not cause a panic compile-time error, unless the constant is actually used somewhere.
Is there a reason for this behaviour? Silently ignoring a const assert seems like very odd behaviour. Is this a bug or expected behaviour?

It is expected

Associated constant definitions undergo constant evaluation only when referenced

https://doc.rust-lang.org/reference/items/associated-items.html#associated-constants

I don't know what the reason is, I assume that it's to reduce compile-times when associated constants aren't referenced.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.