stop doing option transmuting bruh
This commit is contained in:
@@ -37,7 +37,10 @@ impl Widgets {
|
|||||||
pub fn get_dyn_dynamic(&self, id: &Id) -> WidgetWrapper<'_> {
|
pub fn get_dyn_dynamic(&self, id: &Id) -> WidgetWrapper<'_> {
|
||||||
// SAFETY: must guarantee no other mutable references to this widget exist
|
// SAFETY: must guarantee no other mutable references to this widget exist
|
||||||
// done through the borrow variable
|
// done through the borrow variable
|
||||||
let data: &mut WidgetData = unsafe { std::mem::transmute(self.map.get(id)) };
|
#[allow(mutable_transmutes)]
|
||||||
|
let data = unsafe {
|
||||||
|
std::mem::transmute::<&WidgetData, &mut WidgetData>(self.map.get(id).unwrap())
|
||||||
|
};
|
||||||
if data.borrowed {
|
if data.borrowed {
|
||||||
panic!("tried to mutably borrow the same widget twice");
|
panic!("tried to mutably borrow the same widget twice");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user