At it's core, it's just a silly workaround for the fact that rust doesn't allow panicking in the const context at the moment: https://github.com/rust-lang/rust/issues/85194. So, this is just a horrible fact to write if !cond { panic!() }. It weaponizes the fact that, although custom panics don't work in consts, build-in panics are allowed. One of the build-in panics is on index out of bounds (Rust guarantees that out of bounds accesses always trap). Another option is division by zero:
Note that when doing these things, the quality of the error message varies from one approach to another. For "same size types", @Cerber-Ursi's suggestion, or the assert_eq_size! macro are the ones, imho, yielding the better ones (it will given an "expected n, got m" kind of error message, vs. "Any usage of this const will fail: index out of bounds, the len is 0 but got 1".