Skip to content

Commit 20bf587

Browse files
committed
Clarify our UnsafeCell shenanigans
1 parent 6308bb2 commit 20bf587

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ctru-rs/src/applets/error.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ impl PanicHookConfig {
107107
}
108108
}
109109

110-
unsafe fn get(&self) -> *mut errorConf {
110+
// There can only be one invocation of an applet active at any given time, so our `UnsafeCell`
111+
// crimes *should* be okay here.
112+
unsafe fn get(&self) -> &mut errorConf {
111113
unsafe { (*self.error_app.get()).state.as_mut() }
112114
}
113115
}
@@ -130,7 +132,7 @@ pub(crate) fn set_panic_hook(call_old_hook: bool) {
130132
old_hook(panic_info);
131133
}
132134

133-
let error_conf = unsafe { &mut *config.get() };
135+
let error_conf = unsafe { config.get() };
134136

135137
let mut buf1 = itoa::Buffer::new();
136138

0 commit comments

Comments
 (0)