mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 16:21:33 +11:00
Add safety comments to public unsafe functions (#484)
- [x] Changelog updated / no changelog update needed
This commit is contained in:
commit
f0f58741b0
|
@ -24,7 +24,6 @@ fn entry(gba: agb::Gba) -> ! {
|
||||||
fn main(mut gba: agb::Gba) -> ! {
|
fn main(mut gba: agb::Gba) -> ! {
|
||||||
let (mut unmanaged, _sprites) = gba.display.object.get_unmanaged();
|
let (mut unmanaged, _sprites) = gba.display.object.get_unmanaged();
|
||||||
|
|
||||||
loop {
|
|
||||||
let mut palette = [0x0; 16];
|
let mut palette = [0x0; 16];
|
||||||
palette[1] = 0xFF_FF;
|
palette[1] = 0xFF_FF;
|
||||||
palette[2] = 0x00_FF;
|
palette[2] = 0x00_FF;
|
||||||
|
@ -96,4 +95,3 @@ fn main(mut gba: agb::Gba) -> ! {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -231,6 +231,10 @@ pub struct Gba {
|
||||||
impl Gba {
|
impl Gba {
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
#[must_use]
|
#[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 {
|
pub unsafe fn new_in_entry() -> Self {
|
||||||
Self::single_new()
|
Self::single_new()
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,8 @@ pub fn memory_write_hint<T>(val: *mut T) {
|
||||||
/// This seems to be a problem caused by Rust issue #62256:
|
/// This seems to be a problem caused by Rust issue #62256:
|
||||||
/// <https://github.com/rust-lang/rust/issues/62256>
|
/// <https://github.com/rust-lang/rust/issues/62256>
|
||||||
///
|
///
|
||||||
|
/// # Safety
|
||||||
|
///
|
||||||
/// **WARNING FOR ANYONE WHO FINDS THIS**: This implementation will *only* be
|
/// **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
|
/// 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
|
/// is very old, and has no atomics to begin with - only a main thread and
|
||||||
|
|
Loading…
Reference in a new issue