add safety comments to public unsafe functions

This commit is contained in:
Corwin 2023-09-14 12:44:26 +01:00
parent 71559a28d2
commit c12ae4b5d9
No known key found for this signature in database
2 changed files with 6 additions and 0 deletions

View file

@ -231,6 +231,10 @@ pub struct Gba {
impl Gba {
#[doc(hidden)]
#[must_use]
/// # Safety
///
/// May only be called a single time. It is not needed to call this due to
/// it being called internally by the [`entry`] macro.
pub unsafe fn new_in_entry() -> Self {
Self::single_new()
}

View file

@ -33,6 +33,8 @@ pub fn memory_write_hint<T>(val: *mut T) {
/// This seems to be a problem caused by Rust issue #62256:
/// <https://github.com/rust-lang/rust/issues/62256>
///
/// # Safety
///
/// **WARNING FOR ANYONE WHO FINDS THIS**: This implementation will *only* be
/// correct on the GBA, and should not be used on any other platform. The GBA
/// is very old, and has no atomics to begin with - only a main thread and