Skip to content

Commit 9457ebe

Browse files
committed
librustc: Disallow "unsafe" for external functions
1 parent 887c656 commit 9457ebe

36 files changed

+1705
-1825
lines changed

src/libextra/flate.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ pub mod rustrt {
2525

2626
#[link_name = "rustrt"]
2727
extern {
28-
pub unsafe fn tdefl_compress_mem_to_heap(psrc_buf: *const c_void,
29-
src_buf_len: size_t,
30-
pout_len: *mut size_t,
31-
flags: c_int)
32-
-> *c_void;
28+
pub fn tdefl_compress_mem_to_heap(psrc_buf: *const c_void,
29+
src_buf_len: size_t,
30+
pout_len: *mut size_t,
31+
flags: c_int)
32+
-> *c_void;
3333

34-
pub unsafe fn tinfl_decompress_mem_to_heap(psrc_buf: *const c_void,
35-
src_buf_len: size_t,
36-
pout_len: *mut size_t,
37-
flags: c_int)
38-
-> *c_void;
34+
pub fn tinfl_decompress_mem_to_heap(psrc_buf: *const c_void,
35+
src_buf_len: size_t,
36+
pout_len: *mut size_t,
37+
flags: c_int)
38+
-> *c_void;
3939
}
4040
}
4141

src/libextra/rl.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ pub mod rustrt {
2020
use std::libc::{c_char, c_int};
2121

2222
extern {
23-
pub unsafe fn linenoise(prompt: *c_char) -> *c_char;
24-
pub unsafe fn linenoiseHistoryAdd(line: *c_char) -> c_int;
25-
pub unsafe fn linenoiseHistorySetMaxLen(len: c_int) -> c_int;
26-
pub unsafe fn linenoiseHistorySave(file: *c_char) -> c_int;
27-
pub unsafe fn linenoiseHistoryLoad(file: *c_char) -> c_int;
28-
pub unsafe fn linenoiseSetCompletionCallback(callback: *u8);
29-
pub unsafe fn linenoiseAddCompletion(completions: *(), line: *c_char);
23+
pub fn linenoise(prompt: *c_char) -> *c_char;
24+
pub fn linenoiseHistoryAdd(line: *c_char) -> c_int;
25+
pub fn linenoiseHistorySetMaxLen(len: c_int) -> c_int;
26+
pub fn linenoiseHistorySave(file: *c_char) -> c_int;
27+
pub fn linenoiseHistoryLoad(file: *c_char) -> c_int;
28+
pub fn linenoiseSetCompletionCallback(callback: *u8);
29+
pub fn linenoiseAddCompletion(completions: *(), line: *c_char);
3030
}
3131
}
3232

src/libextra/time.rs

+7-10
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,13 @@ pub mod rustrt {
2323

2424
#[abi = "cdecl"]
2525
extern {
26-
pub unsafe fn get_time(sec: &mut i64, nsec: &mut i32);
27-
28-
pub unsafe fn precise_time_ns(ns: &mut u64);
29-
30-
pub unsafe fn rust_tzset();
31-
32-
pub unsafe fn rust_gmtime(sec: i64, nsec: i32, result: &mut Tm);
33-
pub unsafe fn rust_localtime(sec: i64, nsec: i32, result: &mut Tm);
34-
pub unsafe fn rust_timegm(tm: &Tm) -> i64;
35-
pub unsafe fn rust_mktime(tm: &Tm) -> i64;
26+
pub fn get_time(sec: &mut i64, nsec: &mut i32);
27+
pub fn precise_time_ns(ns: &mut u64);
28+
pub fn rust_tzset();
29+
pub fn rust_gmtime(sec: i64, nsec: i32, result: &mut Tm);
30+
pub fn rust_localtime(sec: i64, nsec: i32, result: &mut Tm);
31+
pub fn rust_timegm(tm: &Tm) -> i64;
32+
pub fn rust_mktime(tm: &Tm) -> i64;
3633
}
3734
}
3835

src/libextra/unicode.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,13 @@ pub mod icu {
162162
#[link_name = "icuuc"]
163163
#[abi = "cdecl"]
164164
extern {
165-
pub unsafe fn u_hasBinaryProperty(c: UChar32, which: UProperty)
166-
-> UBool;
167-
pub unsafe fn u_isdigit(c: UChar32) -> UBool;
168-
pub unsafe fn u_islower(c: UChar32) -> UBool;
169-
pub unsafe fn u_isspace(c: UChar32) -> UBool;
170-
pub unsafe fn u_isupper(c: UChar32) -> UBool;
171-
pub unsafe fn u_tolower(c: UChar32) -> UChar32;
172-
pub unsafe fn u_toupper(c: UChar32) -> UChar32;
165+
pub fn u_hasBinaryProperty(c: UChar32, which: UProperty) -> UBool;
166+
pub fn u_isdigit(c: UChar32) -> UBool;
167+
pub fn u_islower(c: UChar32) -> UBool;
168+
pub fn u_isspace(c: UChar32) -> UBool;
169+
pub fn u_isupper(c: UChar32) -> UBool;
170+
pub fn u_tolower(c: UChar32) -> UChar32;
171+
pub fn u_toupper(c: UChar32) -> UChar32;
173172
}
174173
}
175174
}

0 commit comments

Comments
 (0)