Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0a024bd

Browse files
authoredJul 17, 2024
Rollup merge of rust-lang#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 rust-lang#127747 for the zkvm target.
2 parents 0299bb5 + 7ddd7f8 commit 0a024bd

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed
 

‎std/src/sys/pal/zkvm/alloc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::alloc::{GlobalAlloc, Layout, System};
55
unsafe impl GlobalAlloc for System {
66
#[inline]
77
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
8-
abi::sys_alloc_aligned(layout.size(), layout.align())
8+
unsafe { abi::sys_alloc_aligned(layout.size(), layout.align()) }
99
}
1010

1111
#[inline]

‎std/src/sys/pal/zkvm/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//! This is all super highly experimental and not actually intended for
77
//! wide/production use yet, it's still all in the experimental category. This
88
//! will likely change over time.
9+
#![forbid(unsafe_op_in_unsafe_fn)]
910

1011
const WORD_SIZE: usize = core::mem::size_of::<u32>();
1112

0 commit comments

Comments
 (0)
Failed to load comments.