Skip to content
Snippets Groups Projects
Commit 4fabf7f7 authored by Lukas Markeffsky's avatar Lukas Markeffsky
Browse files

use unreachable_unchecked

parent 924c1fda
No related merge requests found
#![no_std]
use core::cell::Cell;
use core::hint;
use core::marker::PhantomPinned;
use core::mem::{self, MaybeUninit};
use core::ops::{Deref, DerefMut};
......@@ -164,7 +165,10 @@ pub struct Xrc<T: ?Sized> {
impl<T: ?Sized> Drop for Xrc<T> {
fn drop(&mut self) {
let Some(root) = Self::inner(self).root.get() else {
unreachable!("missing root");
debug_assert!(false, "missing root");
unsafe {
hint::unreachable_unchecked();
}
};
let state_ref = unsafe { &(*root.as_ptr()).state };
......@@ -187,7 +191,10 @@ impl<T> Clone for Xrc<T> {
fn clone(&self) -> Self {
let root = Self::inner(self).root.get();
let Some(root) = root else {
unreachable!("missing root");
debug_assert!(false, "missing root");
unsafe {
hint::unreachable_unchecked();
}
};
let state_ref = unsafe { &(*root.as_ptr()).state };
......@@ -218,7 +225,10 @@ impl<T: ?Sized> Xrc<T> {
{
let source = Self::inner(&this);
let Some(source_root) = source.root.get() else {
unreachable!("missing root");
debug_assert!(false, "missing root");
unsafe {
hint::unreachable_unchecked();
}
};
let target = f(source);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment