168a020900
Add debug assertions to some unsafe functions
As suggested by https://github.com/rust-lang/rust/issues/51713
~~Some similar code calls `abort()` instead of `panic!()` but aborting doesn't work in a `const fn`, and the intrinsic for doing dispatch based on whether execution is in a const is unstable.~~
This picked up some invalid uses of `get_unchecked` in the compiler, and fixes them.
I can confirm that they do in fact pick up invalid uses of `get_unchecked` in the wild, though the user experience is less-than-awesome:
```
Running unittests (target/x86_64-unknown-linux-gnu/debug/deps/rle_decode_fast-04b7918da2001b50)
running 6 tests
error: test failed, to rerun pass '--lib'
Caused by:
process didn't exit successfully: `/home/ben/rle-decode-helper/target/x86_64-unknown-linux-gnu/debug/deps/rle_decode_fast-04b7918da2001b50` (signal: 4, SIGILL: illegal instruction)
```
~~As best I can tell these changes produce a 6% regression in the runtime of `./x.py test` when `[rust] debug = true` is set.~~
Latest commit (
|
||
---|---|---|
.. | ||
base_n | ||
binary_search_util | ||
fingerprint | ||
graph | ||
intern | ||
obligation_forest | ||
owning_ref | ||
sip128 | ||
small_c_str | ||
small_str | ||
snapshot_map | ||
sorted_map | ||
sso | ||
stable_hasher | ||
tagged_ptr | ||
thin_vec | ||
tiny_list | ||
transitive_relation | ||
vec_map | ||
atomic_ref.rs | ||
base_n.rs | ||
captures.rs | ||
fingerprint.rs | ||
flock.rs | ||
frozen.rs | ||
functor.rs | ||
fx.rs | ||
intern.rs | ||
jobserver.rs | ||
lib.rs | ||
macros.rs | ||
map_in_place.rs | ||
memmap.rs | ||
profiling.rs | ||
sharded.rs | ||
sip128.rs | ||
small_c_str.rs | ||
small_str.rs | ||
sorted_map.rs | ||
stable_hasher.rs | ||
stable_map.rs | ||
stable_set.rs | ||
stack.rs | ||
steal.rs | ||
svh.rs | ||
sync.rs | ||
tagged_ptr.rs | ||
temp_dir.rs | ||
thin_vec.rs | ||
tiny_list.rs | ||
transitive_relation.rs | ||
unhash.rs | ||
vec_linked_list.rs | ||
vec_map.rs | ||
work_queue.rs |