about summary refs log tree commit diff
path: root/src/libstd/sys_common/gnu
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-11-09 18:14:48 +0000
committerbors <bors@rust-lang.org>2017-11-09 18:14:48 +0000
commitf1ea23e2cc72cafad1dc25a06c09ec2de8e323eb (patch)
tree4bafb2a94c6755051649f9e6cfca17c0312712ab /src/libstd/sys_common/gnu
parent98e791e7e135ef6526ca97c33fcf8cd0db50320f (diff)
parent5c3fe111d4a6e72f0461320f5166bcd6aaf2f37f (diff)
downloadrust-f1ea23e2cc72cafad1dc25a06c09ec2de8e323eb.tar.gz
rust-f1ea23e2cc72cafad1dc25a06c09ec2de8e323eb.zip
Auto merge of #45725 - alexcrichton:std-less-rand, r=dtolnay
Working towards a libc-less (wasm32) libstd

This is a series of commits I was able to extract from prepare to comiple libstd on a "bare libc-less" target, notably wasm32. The actual wasm32 bits I intend to send in a PR later, this is just some internal refactorings required for libstd to work with a `libc` that's empty and a few other assorted refactorings.

No functional change should be included in this PR for users of libstd, this is intended to just be internal refactorings.
Diffstat (limited to 'src/libstd/sys_common/gnu')
-rw-r--r--src/libstd/sys_common/gnu/libbacktrace.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libstd/sys_common/gnu/libbacktrace.rs b/src/libstd/sys_common/gnu/libbacktrace.rs
index 016c840d154..75c6bd5d2a2 100644
--- a/src/libstd/sys_common/gnu/libbacktrace.rs
+++ b/src/libstd/sys_common/gnu/libbacktrace.rs
@@ -20,13 +20,13 @@ use sys_common::backtrace::Frame;
 pub fn foreach_symbol_fileline<F>(frame: Frame,
                                   mut f: F,
                                   _: &BacktraceContext) -> io::Result<bool>
-where F: FnMut(&[u8], libc::c_int) -> io::Result<()>
+where F: FnMut(&[u8], u32) -> io::Result<()>
 {
     // pcinfo may return an arbitrary number of file:line pairs,
     // in the order of stack trace (i.e. inlined calls first).
     // in order to avoid allocation, we stack-allocate a fixed size of entries.
     const FILELINE_SIZE: usize = 32;
-    let mut fileline_buf = [(ptr::null(), -1); FILELINE_SIZE];
+    let mut fileline_buf = [(ptr::null(), !0); FILELINE_SIZE];
     let ret;
     let fileline_count = {
         let state = unsafe { init_state() };
@@ -136,7 +136,7 @@ extern {
 // helper callbacks
 ////////////////////////////////////////////////////////////////////////
 
-type FileLine = (*const libc::c_char, libc::c_int);
+type FileLine = (*const libc::c_char, u32);
 
 extern fn error_cb(_data: *mut libc::c_void, _msg: *const libc::c_char,
                    _errnum: libc::c_int) {
@@ -162,7 +162,7 @@ extern fn pcinfo_cb(data: *mut libc::c_void,
         // if the buffer is not full, add file:line to the buffer
         // and adjust the buffer for next possible calls to pcinfo_cb.
         if !buffer.is_empty() {
-            buffer[0] = (filename, lineno);
+            buffer[0] = (filename, lineno as u32);
             unsafe { ptr::write(slot, &mut buffer[1..]); }
         }
     }