Skip to content

Commit 41021b6

Browse files
committed
Auto merge of #130755 - workingjubilee:rollup-zpja9b3, r=workingjubilee
Rollup of 7 pull requests Successful merges: - #129201 (std: implement the `random` feature (alternative version)) - #130536 (bootstrap: Set the dylib path when building books with rustdoc) - #130551 (Fix `break_last_token`.) - #130657 (Remove x86_64-fuchsia and aarch64-fuchsia target aliases) - #130721 (Add more test cases for block-no-opening-brace) - #130736 (Add rustfmt 2024 reformatting to git blame ignore) - #130746 (readd `@tgross35` and `@joboet` to the review rotation) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 3acf865 + 7d70bde commit 41021b6

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/shims/unix/macos/foreign_items.rs

+10
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,16 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
7878
this.write_pointer(environ, dest)?;
7979
}
8080

81+
// Random data generation
82+
"CCRandomGenerateBytes" => {
83+
let [bytes, count] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
84+
let bytes = this.read_pointer(bytes)?;
85+
let count = this.read_target_usize(count)?;
86+
let success = this.eval_libc_i32("kCCSuccess");
87+
this.gen_random(bytes, count)?;
88+
this.write_int(success, dest)?;
89+
}
90+
8191
// Time related shims
8292
"mach_absolute_time" => {
8393
let [] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//@only-target: apple # This directly tests apple-only functions
2+
3+
fn main() {
4+
let mut bytes = [0u8; 24];
5+
let ret = unsafe { libc::CCRandomGenerateBytes(bytes.as_mut_ptr().cast(), bytes.len()) };
6+
assert_eq!(ret, libc::kCCSuccess);
7+
}

0 commit comments

Comments
 (0)