aboutsummaryrefslogtreecommitdiff
path: root/src/safer_unchecked.rs
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2024-06-23 15:41:40 -0700
committeriximeow <me@iximeow.net>2024-06-23 15:43:54 -0700
commit09dcfca94240b6c18fbaa1186781dac0d436e500 (patch)
treef6074169f1457c87d29d90aadade98c6355c1df3 /src/safer_unchecked.rs
parent0a5e9484d091ee9093d98d961896b81b52ea6e42 (diff)
remove yaxpeax-x86 safer_unchecked.rs, it is now in yaxpeax-arch
Diffstat (limited to 'src/safer_unchecked.rs')
-rw-r--r--src/safer_unchecked.rs30
1 files changed, 0 insertions, 30 deletions
diff --git a/src/safer_unchecked.rs b/src/safer_unchecked.rs
deleted file mode 100644
index 34216bc..0000000
--- a/src/safer_unchecked.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-use core::slice::SliceIndex;
-
-pub trait GetSaferUnchecked<T> {
- unsafe fn get_kinda_unchecked<I>(&self, index: I) -> &<I as SliceIndex<[T]>>::Output
- where
- I: SliceIndex<[T]>;
-}
-
-impl<T> GetSaferUnchecked<T> for [T] {
- #[inline(always)]
- unsafe fn get_kinda_unchecked<I>(&self, index: I) -> &<I as SliceIndex<[T]>>::Output
- where
- I: SliceIndex<[T]>,
- {
- if cfg!(debug_assertions) {
- &self[index]
- } else {
- self.get_unchecked(index)
- }
- }
-}
-
-#[inline(always)]
-pub unsafe fn unreachable_kinda_unchecked() -> ! {
- if cfg!(debug_assertions) {
- panic!("UB: Unreachable unchecked was executed")
- } else {
- core::hint::unreachable_unchecked()
- }
-}