memorysafety / rav1d

An AV1 decoder in Rust.
BSD 2-Clause "Simplified" License
321 stars 22 forks source link

Replace `assume` with `assert_unchecked` (Rust 1.81) #1345

Open kkysen opened 3 weeks ago

kkysen commented 3 weeks ago

Rust 1.81 stabilized std::hint::assert_unchecked, which is what we want our assume to be. Our assume is a slightly different implementation (that just calls unreachable_unchecked in the false case), and assert_unchecked is implemented more directly with regards to LLVM IR generation. They are largely the same, but assert_unchecked may be optimized slightly better, and Rust is standardizing around this new interface, so we should switch to it.