Skip to content

Commit a28d16a

Browse files
committed
libc::c_char is not necessarily i8
1 parent 9146a91 commit a28d16a

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/librustc_trans/back/lto.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ pub fn run(sess: &session::Session, llmod: ModuleRef,
144144
// Internalize everything but the reachable symbols of the current module
145145
let cstrs: Vec<::std::c_str::CString> =
146146
reachable.iter().map(|s| s.to_c_str()).collect();
147-
let arr: Vec<*const i8> = cstrs.iter().map(|c| c.as_ptr()).collect();
147+
let arr: Vec<*const libc::c_char> = cstrs.iter().map(|c| c.as_ptr()).collect();
148148
let ptr = arr.as_ptr();
149149
unsafe {
150150
llvm::LLVMRustRunRestrictionPass(llmod,

src/librustrt/c_str.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ mod tests {
578578
assert_eq!(*buf.offset(0), 'f' as libc::c_char);
579579
assert_eq!(*buf.offset(1), 'o' as libc::c_char);
580580
assert_eq!(*buf.offset(2), 'o' as libc::c_char);
581-
assert_eq!(*buf.offset(3), 0xffu8 as i8);
581+
assert_eq!(*buf.offset(3), 0xffu8 as libc::c_char);
582582
assert_eq!(*buf.offset(4), 0);
583583
}
584584
}

src/libstd/os.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ pub fn getenv_as_bytes(n: &str) -> Option<Vec<u8>> {
374374
if s.is_null() {
375375
None
376376
} else {
377-
Some(CString::new(s as *const i8, false).as_bytes_no_nul().to_vec())
377+
Some(CString::new(s as *const libc::c_char, false).as_bytes_no_nul().to_vec())
378378
}
379379
})
380380
}

src/test/run-pass/variadic-ffi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ extern {
1919
}
2020

2121
unsafe fn check<T>(expected: &str, f: |*mut c_char| -> T) {
22-
let mut x = [0i8, ..50];
22+
let mut x = [0 as c_char, ..50];
2323
f(&mut x[0] as *mut c_char);
2424
let res = CString::new(&x[0], false);
2525
assert_eq!(expected, res.as_str().unwrap());

0 commit comments

Comments
 (0)