Skip to content

Commit

Permalink
Rollup merge of rust-lang#127833 - risc0:erik/zkvm-deny-unsafe, r=wor…
Browse files Browse the repository at this point in the history
…kingjubilee

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 rust-lang#127747 for the zkvm target.
  • Loading branch information
tgross35 authored Jul 17, 2024
2 parents 0299bb5 + 7ddd7f8 commit 0a024bd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion std/src/sys/pal/zkvm/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::alloc::{GlobalAlloc, Layout, System};
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]
Expand Down
1 change: 1 addition & 0 deletions std/src/sys/pal/zkvm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>();

Expand Down

0 comments on commit 0a024bd

Please sign in to comment.