Re:Making Rust a Better Fit for Cheri and Other Platforms
by ekhjarta on Thursday April 14, 2022 @05:14AM
(#31024746)
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.
Re:Making Rust a Better Fit for Cheri and Other Platforms
by dgb23 on Thursday April 14, 2022 @05:32AM
(#31024811)
Unwrap 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.
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.