Rollup merge of #127833 - risc0:erik/zkvm-deny-unsafe, r=workingjubilee

zkvm: add `#[forbid(unsafe_op_in_unsafe_fn)]` in `stdlib`

This also adds an additional `unsafe` block to address compiler errors.
This PR is intended to address https://github.com/rust-lang/rust/issues/127747 for the zkvm target.
This commit is contained in:
Trevor Gross 2024-07-16 20:10:13 -05:00 committed by GitHub
commit dd80a728cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View File

@ -5,7 +5,7 @@
unsafe impl GlobalAlloc for System {
#[inline]
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
abi::sys_alloc_aligned(layout.size(), layout.align())
unsafe { abi::sys_alloc_aligned(layout.size(), layout.align()) }
}
#[inline]

View File

@ -6,6 +6,7 @@
//! This is all super highly experimental and not actually intended for
//! wide/production use yet, it's still all in the experimental category. This
//! will likely change over time.
#![forbid(unsafe_op_in_unsafe_fn)]
const WORD_SIZE: usize = core::mem::size_of::<u32>();