3 ms·
It fails at runtime and not at compile time and it only fails if the value is out of range, so you have to test with large enough values to trigger the assertio
by ekhjarta 5y ago
It fails at runtime and not at compile time and it only fails if the value is out of range, so you have to test with large enough values to trigger the assertion during testing.
We want to be able to index with integer types that are smaller than or has the same size as usize, but not with integer types that are larger than usize. And we want those checks at compile time.
- dgb23 5y agoUnwrap isn’t an evil thing to avoid completely. The type system cannot understand all invariants, but you can, and you can make sure they are correctly implemented.
- deleted 4y ago[deleted]