Skip to content

Commit be2c920

Browse files
committed
Change crust -> extern.
1 parent dc98165 commit be2c920

21 files changed

+52
-52
lines changed

src/libcore/task.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ type task_local_element = (*libc::c_void, *libc::c_void, fn@(+*libc::c_void));
612612
// Has to be a pointer at outermost layer; the foreign call returns void *.
613613
type task_local_map = @dvec::dvec<option<task_local_element>>;
614614

615-
crust fn cleanup_task_local_map(map_ptr: *libc::c_void) unsafe {
615+
extern fn cleanup_task_local_map(map_ptr: *libc::c_void) unsafe {
616616
assert !map_ptr.is_null();
617617
// Get and keep the single reference that was created at the beginning.
618618
let map: task_local_map = unsafe::reinterpret_cast(map_ptr);
@@ -1250,7 +1250,7 @@ fn test_tls_modify() unsafe {
12501250
#[test]
12511251
fn test_tls_crust_automorestack_memorial_bug() unsafe {
12521252
// This might result in a stack-canary clobber if the runtime fails to set
1253-
// sp_limit to 0 when calling the cleanup crust - it might automatically
1253+
// sp_limit to 0 when calling the cleanup extern - it might automatically
12541254
// jump over to the rust stack, which causes next_c_sp to get recorded as
12551255
// something within a rust stack segment. Then a subsequent upcall (esp.
12561256
// for logging, think vsnprintf) would run on a stack smaller than 1 MB.

src/libstd/net_ip.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ type get_addr_data = {
257257
output_ch: comm::chan<result::result<[ip_addr]/~,ip_get_addr_err>>
258258
};
259259

260-
crust fn get_addr_cb(handle: *uv_getaddrinfo_t, status: libc::c_int,
260+
extern fn get_addr_cb(handle: *uv_getaddrinfo_t, status: libc::c_int,
261261
res: *addrinfo) unsafe {
262262
log(debug, "in get_addr_cb");
263263
let handle_data = get_data_for_req(handle) as

src/libstd/net_tcp.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,13 +1031,13 @@ type tcp_listen_fc_data = {
10311031
mut active: bool
10321032
};
10331033

1034-
crust fn tcp_lfc_close_cb(handle: *uv::ll::uv_tcp_t) unsafe {
1034+
extern fn tcp_lfc_close_cb(handle: *uv::ll::uv_tcp_t) unsafe {
10351035
let server_data_ptr = uv::ll::get_data_for_uv_handle(
10361036
handle) as *tcp_listen_fc_data;
10371037
comm::send((*server_data_ptr).stream_closed_ch, ());
10381038
}
10391039

1040-
crust fn tcp_lfc_on_connection_cb(handle: *uv::ll::uv_tcp_t,
1040+
extern fn tcp_lfc_on_connection_cb(handle: *uv::ll::uv_tcp_t,
10411041
status: libc::c_int) unsafe {
10421042
let server_data_ptr = uv::ll::get_data_for_uv_handle(handle)
10431043
as *tcp_listen_fc_data;
@@ -1094,7 +1094,7 @@ impl of to_tcp_err_iface for uv::ll::uv_err_data {
10941094
}
10951095
}
10961096

1097-
crust fn on_tcp_read_cb(stream: *uv::ll::uv_stream_t,
1097+
extern fn on_tcp_read_cb(stream: *uv::ll::uv_stream_t,
10981098
nread: libc::ssize_t,
10991099
++buf: uv::ll::uv_buf_t) unsafe {
11001100
log(debug, #fmt("entering on_tcp_read_cb stream: %? nread: %?",
@@ -1128,7 +1128,7 @@ crust fn on_tcp_read_cb(stream: *uv::ll::uv_stream_t,
11281128
log(debug, "exiting on_tcp_read_cb");
11291129
}
11301130

1131-
crust fn on_alloc_cb(handle: *libc::c_void,
1131+
extern fn on_alloc_cb(handle: *libc::c_void,
11321132
++suggested_size: size_t)
11331133
-> uv::ll::uv_buf_t unsafe {
11341134
log(debug, "tcp read on_alloc_cb!");
@@ -1144,15 +1144,15 @@ type tcp_socket_close_data = {
11441144
closed_ch: comm::chan<()>
11451145
};
11461146

1147-
crust fn tcp_socket_dtor_close_cb(handle: *uv::ll::uv_tcp_t) unsafe {
1147+
extern fn tcp_socket_dtor_close_cb(handle: *uv::ll::uv_tcp_t) unsafe {
11481148
let data = uv::ll::get_data_for_uv_handle(handle)
11491149
as *tcp_socket_close_data;
11501150
let closed_ch = (*data).closed_ch;
11511151
comm::send(closed_ch, ());
11521152
log(debug, "tcp_socket_dtor_close_cb exiting..");
11531153
}
11541154

1155-
crust fn tcp_write_complete_cb(write_req: *uv::ll::uv_write_t,
1155+
extern fn tcp_write_complete_cb(write_req: *uv::ll::uv_write_t,
11561156
status: libc::c_int) unsafe {
11571157
let write_data_ptr = uv::ll::get_data_for_req(write_req)
11581158
as *write_req_data;
@@ -1178,18 +1178,18 @@ type connect_req_data = {
11781178
closed_signal_ch: comm::chan<()>
11791179
};
11801180

1181-
crust fn stream_error_close_cb(handle: *uv::ll::uv_tcp_t) unsafe {
1181+
extern fn stream_error_close_cb(handle: *uv::ll::uv_tcp_t) unsafe {
11821182
let data = uv::ll::get_data_for_uv_handle(handle) as
11831183
*connect_req_data;
11841184
comm::send((*data).closed_signal_ch, ());
11851185
log(debug, #fmt("exiting steam_error_close_cb for %?", handle));
11861186
}
11871187

1188-
crust fn tcp_connect_close_cb(handle: *uv::ll::uv_tcp_t) unsafe {
1188+
extern fn tcp_connect_close_cb(handle: *uv::ll::uv_tcp_t) unsafe {
11891189
log(debug, #fmt("closed client tcp handle %?", handle));
11901190
}
11911191

1192-
crust fn tcp_connect_on_connect_cb(connect_req_ptr: *uv::ll::uv_connect_t,
1192+
extern fn tcp_connect_on_connect_cb(connect_req_ptr: *uv::ll::uv_connect_t,
11931193
status: libc::c_int) unsafe {
11941194
let conn_data_ptr = (uv::ll::get_data_for_req(connect_req_ptr)
11951195
as *connect_req_data);

src/libstd/timer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ fn recv_timeout<T: copy send>(iotask: iotask,
116116
}
117117

118118
// INTERNAL API
119-
crust fn delayed_send_cb(handle: *uv::ll::uv_timer_t,
119+
extern fn delayed_send_cb(handle: *uv::ll::uv_timer_t,
120120
status: libc::c_int) unsafe {
121121
log(debug, #fmt("delayed_send_cb handle %? status %?", handle, status));
122122
let timer_done_ch =
@@ -133,7 +133,7 @@ crust fn delayed_send_cb(handle: *uv::ll::uv_timer_t,
133133
}
134134
}
135135

136-
crust fn delayed_send_close_cb(handle: *uv::ll::uv_timer_t) unsafe {
136+
extern fn delayed_send_close_cb(handle: *uv::ll::uv_timer_t) unsafe {
137137
log(debug, #fmt("delayed_send_close_cb handle %?", handle));
138138
let timer_done_ch =
139139
*(uv::ll::get_data_for_uv_handle(handle) as *comm::chan<()>);

src/libstd/uv_global_loop.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,15 @@ fn spawn_loop() -> iotask unsafe {
116116

117117
#[cfg(test)]
118118
mod test {
119-
crust fn simple_timer_close_cb(timer_ptr: *ll::uv_timer_t) unsafe {
119+
extern fn simple_timer_close_cb(timer_ptr: *ll::uv_timer_t) unsafe {
120120
let exit_ch_ptr = ll::get_data_for_uv_handle(
121121
timer_ptr as *libc::c_void) as *comm::chan<bool>;
122122
let exit_ch = *exit_ch_ptr;
123123
comm::send(exit_ch, true);
124124
log(debug, #fmt("EXIT_CH_PTR simple_timer_close_cb exit_ch_ptr: %?",
125125
exit_ch_ptr));
126126
}
127-
crust fn simple_timer_cb(timer_ptr: *ll::uv_timer_t,
127+
extern fn simple_timer_cb(timer_ptr: *ll::uv_timer_t,
128128
_status: libc::c_int) unsafe {
129129
log(debug, "in simple timer cb");
130130
ll::timer_stop(timer_ptr);

src/libstd/uv_iotask.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,10 @@ fn send_msg(iotask: iotask,
148148
}
149149

150150
#[doc ="Dispatch all pending messages"]
151-
crust fn wake_up_cb(async_handle: *ll::uv_async_t,
151+
extern fn wake_up_cb(async_handle: *ll::uv_async_t,
152152
status: int) unsafe {
153153

154-
log(debug, #fmt("wake_up_cb crust.. handle: %? status: %?",
154+
log(debug, #fmt("wake_up_cb extern.. handle: %? status: %?",
155155
async_handle, status));
156156

157157
let loop_ptr = ll::get_loop_for_uv_handle(async_handle);
@@ -176,7 +176,7 @@ fn begin_teardown(data: *iotask_loop_data) unsafe {
176176
ll::close(async_handle as *c_void, tear_down_close_cb);
177177
}
178178

179-
crust fn tear_down_close_cb(handle: *ll::uv_async_t) unsafe {
179+
extern fn tear_down_close_cb(handle: *ll::uv_async_t) unsafe {
180180
let loop_ptr = ll::get_loop_for_uv_handle(handle);
181181
let loop_refs = ll::loop_refcount(loop_ptr);
182182
log(debug, #fmt("tear_down_close_cb called, closing handle at %? refs %?",
@@ -186,13 +186,13 @@ crust fn tear_down_close_cb(handle: *ll::uv_async_t) unsafe {
186186

187187
#[cfg(test)]
188188
mod test {
189-
crust fn async_close_cb(handle: *ll::uv_async_t) unsafe {
189+
extern fn async_close_cb(handle: *ll::uv_async_t) unsafe {
190190
log(debug, #fmt("async_close_cb handle %?", handle));
191191
let exit_ch = (*(ll::get_data_for_uv_handle(handle)
192192
as *ah_data)).exit_ch;
193193
comm::send(exit_ch, ());
194194
}
195-
crust fn async_handle_cb(handle: *ll::uv_async_t, status: libc::c_int)
195+
extern fn async_handle_cb(handle: *ll::uv_async_t, status: libc::c_int)
196196
unsafe {
197197
log(debug, #fmt("async_handle_cb handle %? status %?",handle,status));
198198
ll::close(handle, async_close_cb);
@@ -231,11 +231,11 @@ mod test {
231231
ret comm::recv(iotask_port);
232232
}
233233

234-
crust fn lifetime_handle_close(handle: *libc::c_void) unsafe {
234+
extern fn lifetime_handle_close(handle: *libc::c_void) unsafe {
235235
log(debug, #fmt("lifetime_handle_close ptr %?", handle));
236236
}
237237

238-
crust fn lifetime_async_callback(handle: *libc::c_void,
238+
extern fn lifetime_async_callback(handle: *libc::c_void,
239239
status: libc::c_int) {
240240
log(debug, #fmt("lifetime_handle_close ptr %? status %?",
241241
handle, status));

src/libstd/uv_ll.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,12 +1016,12 @@ mod test {
10161016
read_chan: *comm::chan<str>
10171017
};
10181018

1019-
crust fn after_close_cb(handle: *libc::c_void) {
1019+
extern fn after_close_cb(handle: *libc::c_void) {
10201020
log(debug, #fmt("after uv_close! handle ptr: %?",
10211021
handle));
10221022
}
10231023

1024-
crust fn on_alloc_cb(handle: *libc::c_void,
1024+
extern fn on_alloc_cb(handle: *libc::c_void,
10251025
++suggested_size: libc::size_t)
10261026
-> uv_buf_t unsafe {
10271027
log(debug, "on_alloc_cb!");
@@ -1033,7 +1033,7 @@ mod test {
10331033
ret buf_init(char_ptr, suggested_size as uint);
10341034
}
10351035

1036-
crust fn on_read_cb(stream: *uv_stream_t,
1036+
extern fn on_read_cb(stream: *uv_stream_t,
10371037
nread: libc::ssize_t,
10381038
++buf: uv_buf_t) unsafe {
10391039
let nread = nread as int;
@@ -1067,7 +1067,7 @@ mod test {
10671067
log(debug, "CLIENT exiting on_read_cb");
10681068
}
10691069

1070-
crust fn on_write_complete_cb(write_req: *uv_write_t,
1070+
extern fn on_write_complete_cb(write_req: *uv_write_t,
10711071
status: libc::c_int) unsafe {
10721072
log(debug, #fmt("CLIENT beginning on_write_complete_cb status: %d",
10731073
status as int));
@@ -1079,7 +1079,7 @@ mod test {
10791079
result as int));
10801080
}
10811081

1082-
crust fn on_connect_cb(connect_req_ptr: *uv_connect_t,
1082+
extern fn on_connect_cb(connect_req_ptr: *uv_connect_t,
10831083
status: libc::c_int) unsafe {
10841084
log(debug, #fmt("beginning on_connect_cb .. status: %d",
10851085
status as int));
@@ -1184,12 +1184,12 @@ mod test {
11841184

11851185
}
11861186

1187-
crust fn server_after_close_cb(handle: *libc::c_void) unsafe {
1187+
extern fn server_after_close_cb(handle: *libc::c_void) unsafe {
11881188
log(debug, #fmt("SERVER server stream closed, should exit.. h: %?",
11891189
handle));
11901190
}
11911191

1192-
crust fn client_stream_after_close_cb(handle: *libc::c_void)
1192+
extern fn client_stream_after_close_cb(handle: *libc::c_void)
11931193
unsafe {
11941194
log(debug, "SERVER: closed client stream, now closing server stream");
11951195
let client_data = get_data_for_uv_handle(
@@ -1199,15 +1199,15 @@ mod test {
11991199
server_after_close_cb);
12001200
}
12011201

1202-
crust fn after_server_resp_write(req: *uv_write_t) unsafe {
1202+
extern fn after_server_resp_write(req: *uv_write_t) unsafe {
12031203
let client_stream_ptr =
12041204
get_stream_handle_from_write_req(req);
12051205
log(debug, "SERVER: resp sent... closing client stream");
12061206
close(client_stream_ptr as *libc::c_void,
12071207
client_stream_after_close_cb)
12081208
}
12091209

1210-
crust fn on_server_read_cb(client_stream_ptr: *uv_stream_t,
1210+
extern fn on_server_read_cb(client_stream_ptr: *uv_stream_t,
12111211
nread: libc::ssize_t,
12121212
++buf: uv_buf_t) unsafe {
12131213
let nread = nread as int;
@@ -1268,7 +1268,7 @@ mod test {
12681268
log(debug, "SERVER exiting on_read_cb");
12691269
}
12701270

1271-
crust fn server_connection_cb(server_stream_ptr:
1271+
extern fn server_connection_cb(server_stream_ptr:
12721272
*uv_stream_t,
12731273
status: libc::c_int) unsafe {
12741274
log(debug, "client connecting!");
@@ -1335,12 +1335,12 @@ mod test {
13351335
continue_chan: *comm::chan<bool>
13361336
};
13371337

1338-
crust fn async_close_cb(handle: *libc::c_void) {
1338+
extern fn async_close_cb(handle: *libc::c_void) {
13391339
log(debug, #fmt("SERVER: closing async cb... h: %?",
13401340
handle));
13411341
}
13421342

1343-
crust fn continue_async_cb(async_handle: *uv_async_t,
1343+
extern fn continue_async_cb(async_handle: *uv_async_t,
13441344
status: libc::c_int) unsafe {
13451345
// once we're in the body of this callback,
13461346
// the tcp server's loop is set up, so we

src/libsyntax/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ enum purity {
563563
pure_fn, // declared with "pure fn"
564564
unsafe_fn, // declared with "unsafe fn"
565565
impure_fn, // declared with "fn"
566-
extern_fn, // declared with "crust fn"
566+
extern_fn, // declared with "extern fn"
567567
}
568568

569569
#[auto_serialize]

src/rustc/middle/trans/foreign.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ fn trans_foreign_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
10091009

10101010
fn build_args(bcx: block, tys: @c_stack_tys,
10111011
llargbundle: ValueRef) -> ~[ValueRef] {
1012-
let _icx = bcx.insn_ctxt("foreign::crust::shim::build_args");
1012+
let _icx = bcx.insn_ctxt("foreign::extern::shim::build_args");
10131013
let mut llargvals = ~[];
10141014
let mut i = 0u;
10151015
let n = vec::len(tys.arg_tys);

src/rustc/middle/typeck/check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2031,7 +2031,7 @@ fn ty_param_bounds_and_ty_for_def(fcx: @fn_ctxt, sp: span, defn: ast::def) ->
20312031
}
20322032
}
20332033
ast::def_fn(id, ast::extern_fn) {
2034-
// Crust functions are just u8 pointers
2034+
// extern functions are just u8 pointers
20352035
ret {
20362036
bounds: @~[],
20372037
rp: ast::rp_none,

src/test/compile-fail/crust-no-call.rs renamed to src/test/compile-fail/extern-no-call.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// error-pattern:expected function or foreign function but found *u8
2-
crust fn f() {
2+
extern fn f() {
33
}
44

55
fn main() {
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// error-pattern:expected `fn()` but found `*u8`
2-
crust fn f() {
2+
extern fn f() {
33
}
44

55
fn main() {
6-
// Crust functions are *u8 types
6+
// extern functions are *u8 types
77
let _x: fn() = f;
88
}

src/test/run-fail/crust-fail.rs renamed to src/test/run-fail/extern-fail.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ extern mod rustrt {
77
data: libc::uintptr_t) -> libc::uintptr_t;
88
}
99

10-
crust fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
10+
extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
1111
if data == 1u {
1212
data
1313
} else {

src/test/run-pass/crust-1.rs renamed to src/test/run-pass/extern-1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
crust fn f() {
1+
extern fn f() {
22
}
33

44
fn main() {

src/test/run-pass/crust-call-deep.rs renamed to src/test/run-pass/extern-call-deep.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ extern mod rustrt {
33
data: libc::uintptr_t) -> libc::uintptr_t;
44
}
55

6-
crust fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
6+
extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
77
if data == 1u {
88
data
99
} else {

src/test/run-pass/crust-call-deep2.rs renamed to src/test/run-pass/extern-call-deep2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ extern mod rustrt {
33
data: libc::uintptr_t) -> libc::uintptr_t;
44
}
55

6-
crust fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
6+
extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
77
if data == 1u {
88
data
99
} else {

src/test/run-pass/crust-call-scrub.rs renamed to src/test/run-pass/extern-call-scrub.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ extern mod rustrt {
77
data: libc::uintptr_t) -> libc::uintptr_t;
88
}
99

10-
crust fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
10+
extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
1111
if data == 1u {
1212
data
1313
} else {

src/test/run-pass/crust-call.rs renamed to src/test/run-pass/extern-call.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ extern mod rustrt {
33
data: libc::uintptr_t) -> libc::uintptr_t;
44
}
55

6-
crust fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
6+
extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
77
if data == 1u {
88
data
99
} else {

src/test/run-pass/crust-stress.rs renamed to src/test/run-pass/extern-stress.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ extern mod rustrt {
66
data: libc::uintptr_t) -> libc::uintptr_t;
77
}
88

9-
crust fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
9+
extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
1010
if data == 1u {
1111
data
1212
} else {

0 commit comments

Comments
 (0)