rollup merge of #27674: zaeleus/ios-imports
See https://github.com/rust-lang/rust/issues/27590#issuecomment-128885975.
This commit is contained in:
commit
00ac2c0550
2 changed files with 5 additions and 3 deletions
|
|
@ -182,12 +182,12 @@ mod imp {
|
|||
|
||||
#[cfg(target_os = "ios")]
|
||||
mod imp {
|
||||
use prelude::v1::*;
|
||||
#[cfg(stage0)] use prelude::v1::*;
|
||||
|
||||
use io;
|
||||
use mem;
|
||||
use rand::Rng;
|
||||
use libc::{c_int, c_void, size_t};
|
||||
use libc::{c_int, size_t};
|
||||
|
||||
/// A random number generator that retrieves randomness straight from
|
||||
/// the operating system. Platform sources:
|
||||
|
|
|
|||
|
|
@ -107,6 +107,8 @@ use sys_common::backtrace::*;
|
|||
#[cfg(all(target_os = "ios", target_arch = "arm"))]
|
||||
#[inline(never)]
|
||||
pub fn write(w: &mut Write) -> io::Result<()> {
|
||||
use mem;
|
||||
|
||||
extern {
|
||||
fn backtrace(buf: *mut *mut libc::c_void,
|
||||
sz: libc::c_int) -> libc::c_int;
|
||||
|
|
@ -121,7 +123,7 @@ pub fn write(w: &mut Write) -> io::Result<()> {
|
|||
try!(writeln!(w, "stack backtrace:"));
|
||||
// 100 lines should be enough
|
||||
const SIZE: usize = 100;
|
||||
let mut buf: [*mut libc::c_void; SIZE] = unsafe {mem::zeroed()};
|
||||
let mut buf: [*mut libc::c_void; SIZE] = unsafe { mem::zeroed() };
|
||||
let cnt = unsafe { backtrace(buf.as_mut_ptr(), SIZE as libc::c_int) as usize};
|
||||
|
||||
// skipping the first one as it is write itself
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue