Rollup merge of #127833 - risc0:erik/zkvm-deny-unsafe, r=workingjubilee · model-checking/verify-rust-std@0a024bd (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Commit 0a024bd

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.

File tree

2 files changed

lines changed

2 files changed

lines changed

Lines changed: 1 addition & 1 deletion

Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ use crate::alloc::{GlobalAlloc, Layout, System};
5 5 unsafe impl GlobalAlloc for System {
6 6 #[inline]
7 7 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()) }
9 9 }
10 10
11 11 #[inline]

Lines changed: 1 addition & 0 deletions

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