Skip to content

Commit 697f1e3

Browse files
committed
Change 'native' and 'crust' to 'extern'.
This comes with a terminology change. All linkage-symbols are 'extern' now, including rust syms in other crates. Some extern ABIs are merely "foreign". The term "native" is retired, not clear/useful. What was "crust" is now "extern" applied to a _definition_. This is a bit of an overloading, but should be unambiguous: it means that the definition should be made available to some non-rust ABI.
1 parent 999b567 commit 697f1e3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+377
-353
lines changed

src/libcore/os.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ mod global_env {
167167
sched: some({
168168
mode: task::single_threaded,
169169
// FIXME (#2621): This would be a good place to use a
170-
// very small native stack
171-
native_stack_size: none
170+
// very small foreign stack
171+
foreign_stack_size: none
172172
})
173173
with task::get_opts(builder)
174174
});

src/libcore/task.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,17 @@ Scheduler configuration options
104104
105105
* sched_mode - The operating mode of the scheduler
106106
107-
* native_stack_size - The size of the native stack, in bytes
107+
* foreign_stack_size - The size of the foreign stack, in bytes
108108
109-
Rust code runs on Rust-specific stacks. When Rust code calls native code
110-
(via functions in native modules) it switches to a typical, large stack
109+
Rust code runs on Rust-specific stacks. When Rust code calls foreign code
110+
(via functions in foreign modules) it switches to a typical, large stack
111111
appropriate for running code written in languages like C. By default these
112-
native stacks have unspecified size, but with this option their size can
112+
foreign stacks have unspecified size, but with this option their size can
113113
be precisely specified.
114114
"]
115115
type sched_opts = {
116116
mode: sched_mode,
117-
native_stack_size: option<uint>
117+
foreign_stack_size: option<uint>
118118
};
119119

120120
#[doc = "
@@ -140,7 +140,7 @@ Task configuration options
140140
into a new scheduler with the specific properties required.
141141
142142
This is of particular importance for libraries which want to call
143-
into native code that blocks. Without doing so in a different
143+
into foreign code that blocks. Without doing so in a different
144144
scheduler other tasks will be impeded or even blocked indefinitely.
145145
146146
"]
@@ -408,7 +408,7 @@ fn spawn_sched(mode: sched_mode, +f: fn~()) {
408408
set_opts(builder, {
409409
sched: some({
410410
mode: mode,
411-
native_stack_size: none
411+
foreign_stack_size: none
412412
})
413413
with get_opts(builder)
414414
});
@@ -542,8 +542,8 @@ fn spawn_raw(opts: task_opts, +f: fn~()) {
542542
}
543543

544544
fn new_task_in_new_sched(opts: sched_opts) -> *rust_task {
545-
if opts.native_stack_size != none {
546-
fail "native_stack_size scheduler option unimplemented";
545+
if opts.foreign_stack_size != none {
546+
fail "foreign_stack_size scheduler option unimplemented";
547547
}
548548

549549
let num_threads = alt opts.mode {
@@ -804,7 +804,7 @@ native mod testrt {
804804
#[test]
805805
fn test_spawn_sched_blocking() {
806806

807-
// Testing that a task in one scheduler can block natively
807+
// Testing that a task in one scheduler can block in foreign code
808808
// without affecting other schedulers
809809
iter::repeat(20u) {||
810810

@@ -947,7 +947,7 @@ fn test_osmain() {
947947
let opts = {
948948
sched: some({
949949
mode: osmain,
950-
native_stack_size: none
950+
foreign_stack_size: none
951951
})
952952
with get_opts(buildr)
953953
};

src/libstd/uv_global_loop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ fn get_monitor_task_gl() -> iotask unsafe {
4646
supervise: false,
4747
sched: some({
4848
mode: task::single_threaded,
49-
native_stack_size: none
49+
foreign_stack_size: none
5050
})
5151
with task::get_opts(builder)
5252
});

src/libstd/uv_iotask.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn spawn_iotask(-builder: task::builder) -> iotask {
3434
set_opts(builder, {
3535
sched: some({
3636
mode: single_threaded,
37-
native_stack_size: none
37+
foreign_stack_size: none
3838
})
3939
with get_opts(builder)
4040
});

src/libstd/uv_ll.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,80 +1314,80 @@ mod test {
13141314
#[test]
13151315
#[ignore(cfg(target_os = "freebsd"))]
13161316
fn test_uv_ll_struct_size_uv_tcp_t() {
1317-
let native_handle_size = rustrt::rust_uv_helper_uv_tcp_t_size();
1317+
let foreign_handle_size = rustrt::rust_uv_helper_uv_tcp_t_size();
13181318
let rust_handle_size = sys::size_of::<uv_tcp_t>();
13191319
let output = #fmt("uv_tcp_t -- native: %u rust: %u",
1320-
native_handle_size as uint, rust_handle_size);
1320+
foreign_handle_size as uint, rust_handle_size);
13211321
log(debug, output);
1322-
assert native_handle_size as uint == rust_handle_size;
1322+
assert foreign_handle_size as uint == rust_handle_size;
13231323
}
13241324
#[test]
13251325
#[ignore(cfg(target_os = "freebsd"))]
13261326
fn test_uv_ll_struct_size_uv_connect_t() {
1327-
let native_handle_size =
1327+
let foreign_handle_size =
13281328
rustrt::rust_uv_helper_uv_connect_t_size();
13291329
let rust_handle_size = sys::size_of::<uv_connect_t>();
13301330
let output = #fmt("uv_connect_t -- native: %u rust: %u",
1331-
native_handle_size as uint, rust_handle_size);
1331+
foreign_handle_size as uint, rust_handle_size);
13321332
log(debug, output);
1333-
assert native_handle_size as uint == rust_handle_size;
1333+
assert foreign_handle_size as uint == rust_handle_size;
13341334
}
13351335
#[test]
13361336
#[ignore(cfg(target_os = "freebsd"))]
13371337
fn test_uv_ll_struct_size_uv_buf_t() {
1338-
let native_handle_size =
1338+
let foreign_handle_size =
13391339
rustrt::rust_uv_helper_uv_buf_t_size();
13401340
let rust_handle_size = sys::size_of::<uv_buf_t>();
13411341
let output = #fmt("uv_buf_t -- native: %u rust: %u",
1342-
native_handle_size as uint, rust_handle_size);
1342+
foreign_handle_size as uint, rust_handle_size);
13431343
log(debug, output);
1344-
assert native_handle_size as uint == rust_handle_size;
1344+
assert foreign_handle_size as uint == rust_handle_size;
13451345
}
13461346
#[test]
13471347
#[ignore(cfg(target_os = "freebsd"))]
13481348
fn test_uv_ll_struct_size_uv_write_t() {
1349-
let native_handle_size =
1349+
let foreign_handle_size =
13501350
rustrt::rust_uv_helper_uv_write_t_size();
13511351
let rust_handle_size = sys::size_of::<uv_write_t>();
13521352
let output = #fmt("uv_write_t -- native: %u rust: %u",
1353-
native_handle_size as uint, rust_handle_size);
1353+
foreign_handle_size as uint, rust_handle_size);
13541354
log(debug, output);
1355-
assert native_handle_size as uint == rust_handle_size;
1355+
assert foreign_handle_size as uint == rust_handle_size;
13561356
}
13571357

13581358
#[test]
13591359
#[ignore(cfg(target_os = "freebsd"))]
13601360
fn test_uv_ll_struct_size_sockaddr_in() {
1361-
let native_handle_size =
1361+
let foreign_handle_size =
13621362
rustrt::rust_uv_helper_sockaddr_in_size();
13631363
let rust_handle_size = sys::size_of::<sockaddr_in>();
13641364
let output = #fmt("sockaddr_in -- native: %u rust: %u",
1365-
native_handle_size as uint, rust_handle_size);
1365+
foreign_handle_size as uint, rust_handle_size);
13661366
log(debug, output);
1367-
assert native_handle_size as uint == rust_handle_size;
1367+
assert foreign_handle_size as uint == rust_handle_size;
13681368
}
13691369

13701370
#[test]
13711371
#[ignore(cfg(target_os = "freebsd"))]
13721372
fn test_uv_ll_struct_size_uv_async_t() {
1373-
let native_handle_size =
1373+
let foreign_handle_size =
13741374
rustrt::rust_uv_helper_uv_async_t_size();
13751375
let rust_handle_size = sys::size_of::<uv_async_t>();
13761376
let output = #fmt("uv_async_t -- native: %u rust: %u",
1377-
native_handle_size as uint, rust_handle_size);
1377+
foreign_handle_size as uint, rust_handle_size);
13781378
log(debug, output);
1379-
assert native_handle_size as uint == rust_handle_size;
1379+
assert foreign_handle_size as uint == rust_handle_size;
13801380
}
13811381

13821382
#[test]
13831383
#[ignore(cfg(target_os = "freebsd"))]
13841384
fn test_uv_ll_struct_size_uv_timer_t() {
1385-
let native_handle_size =
1385+
let foreign_handle_size =
13861386
rustrt::rust_uv_helper_uv_timer_t_size();
13871387
let rust_handle_size = sys::size_of::<uv_timer_t>();
13881388
let output = #fmt("uv_timer_t -- native: %u rust: %u",
1389-
native_handle_size as uint, rust_handle_size);
1389+
foreign_handle_size as uint, rust_handle_size);
13901390
log(debug, output);
1391-
assert native_handle_size as uint == rust_handle_size;
1391+
assert foreign_handle_size as uint == rust_handle_size;
13921392
}
13931393
}

src/libsyntax/ast.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ enum def {
7373
def_fn(def_id, purity),
7474
def_self(node_id),
7575
def_mod(def_id),
76-
def_native_mod(def_id),
76+
def_foreign_mod(def_id),
7777
def_const(def_id),
7878
def_arg(node_id, mode),
7979
def_local(node_id, bool /* is_mutbl */),
@@ -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-
crust_fn, // declared with "crust fn"
566+
extern_fn, // declared with "crust fn"
567567
}
568568

569569
#[auto_serialize]
@@ -584,16 +584,16 @@ type method = {ident: ident, attrs: [attribute]/~,
584584
type _mod = {view_items: [@view_item]/~, items: [@item]/~};
585585

586586
#[auto_serialize]
587-
enum native_abi {
588-
native_abi_rust_intrinsic,
589-
native_abi_cdecl,
590-
native_abi_stdcall,
587+
enum foreign_abi {
588+
foreign_abi_rust_intrinsic,
589+
foreign_abi_cdecl,
590+
foreign_abi_stdcall,
591591
}
592592

593593
#[auto_serialize]
594-
type native_mod =
594+
type foreign_mod =
595595
{view_items: [@view_item]/~,
596-
items: [@native_item]/~};
596+
items: [@foreign_item]/~};
597597

598598
#[auto_serialize]
599599
type variant_arg = {ty: @ty, id: node_id};
@@ -681,7 +681,7 @@ enum item_ {
681681
item_const(@ty, @expr),
682682
item_fn(fn_decl, [ty_param]/~, blk),
683683
item_mod(_mod),
684-
item_native_mod(native_mod),
684+
item_foreign_mod(foreign_mod),
685685
item_ty(@ty, [ty_param]/~, region_param),
686686
item_enum([variant]/~, [ty_param]/~, region_param),
687687
item_class([ty_param]/~, /* ty params for class */
@@ -728,16 +728,16 @@ type class_dtor_ = {id: node_id,
728728
body: blk};
729729

730730
#[auto_serialize]
731-
type native_item =
731+
type foreign_item =
732732
{ident: ident,
733733
attrs: [attribute]/~,
734-
node: native_item_,
734+
node: foreign_item_,
735735
id: node_id,
736736
span: span};
737737

738738
#[auto_serialize]
739-
enum native_item_ {
740-
native_item_fn(fn_decl, [ty_param]/~),
739+
enum foreign_item_ {
740+
foreign_item_fn(fn_decl, [ty_param]/~),
741741
}
742742

743743
// The data we save and restore about an inlined item or method. This is not
@@ -747,7 +747,7 @@ enum native_item_ {
747747
enum inlined_item {
748748
ii_item(@item),
749749
ii_method(def_id /* impl id */, @method),
750-
ii_native(@native_item),
750+
ii_foreign(@foreign_item),
751751
ii_ctor(class_ctor, ident, [ty_param]/~, def_id /* parent id */),
752752
ii_dtor(class_dtor, ident, [ty_param]/~, def_id /* parent id */)
753753
}

src/libsyntax/ast_map.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn path_to_str(p: path) -> str {
3434

3535
enum ast_node {
3636
node_item(@item, @path),
37-
node_native_item(@native_item, native_abi, @path),
37+
node_foreign_item(@foreign_item, foreign_abi, @path),
3838
node_method(@method, def_id /* impl did */, @path /* path to the impl */),
3939
node_variant(variant, @item, @path),
4040
node_expr(@expr),
@@ -104,8 +104,8 @@ fn map_decoded_item(diag: span_handler,
104104
// add it to the table now:
105105
alt ii {
106106
ii_item(*) | ii_ctor(*) | ii_dtor(*) { /* fallthrough */ }
107-
ii_native(i) {
108-
cx.map.insert(i.id, node_native_item(i, native_abi_rust_intrinsic,
107+
ii_foreign(i) {
108+
cx.map.insert(i.id, node_foreign_item(i, foreign_abi_rust_intrinsic,
109109
@path));
110110
}
111111
ii_method(impl_did, m) {
@@ -202,14 +202,14 @@ fn map_item(i: @item, cx: ctx, v: vt) {
202202
extend(cx, i.ident)));
203203
}
204204
}
205-
item_native_mod(nm) {
206-
let abi = alt attr::native_abi(i.attrs) {
205+
item_foreign_mod(nm) {
206+
let abi = alt attr::foreign_abi(i.attrs) {
207207
either::left(msg) { cx.diag.span_fatal(i.span, msg); }
208208
either::right(abi) { abi }
209209
};
210210
for nm.items.each {|nitem|
211211
cx.map.insert(nitem.id,
212-
node_native_item(nitem, abi,
212+
node_foreign_item(nitem, abi,
213213
/* FIXME (#2543) */
214214
@copy cx.path));
215215
}
@@ -228,7 +228,7 @@ fn map_item(i: @item, cx: ctx, v: vt) {
228228
_ { }
229229
}
230230
alt i.node {
231-
item_mod(_) | item_native_mod(_) {
231+
item_mod(_) | item_foreign_mod(_) {
232232
vec::push(cx.path, path_mod(i.ident));
233233
}
234234
_ { vec::push(cx.path, path_name(i.ident)); }
@@ -269,7 +269,7 @@ fn node_id_to_str(map: map, id: node_id) -> str {
269269
some(node_item(item, path)) {
270270
#fmt["item %s (id=%?)", path_ident_to_str(*path, item.ident), id]
271271
}
272-
some(node_native_item(item, abi, path)) {
272+
some(node_foreign_item(item, abi, path)) {
273273
#fmt["native item %s with abi %? (id=%?)",
274274
path_ident_to_str(*path, item.ident), abi, id]
275275
}

src/libsyntax/ast_util.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ fn variant_def_ids(d: def) -> {enm: def_id, var: def_id} {
5151
pure fn def_id_of_def(d: def) -> def_id {
5252
alt d {
5353
def_fn(id, _) | def_mod(id) |
54-
def_native_mod(id) | def_const(id) |
54+
def_foreign_mod(id) | def_const(id) |
5555
def_variant(_, id) | def_ty(id) | def_ty_param(id, _) |
5656
def_use(id) | def_class(id) { id }
5757
def_arg(id, _) | def_local(id, _) | def_self(id) |
@@ -321,7 +321,7 @@ impl inlined_item_methods for inlined_item {
321321
fn ident() -> ident {
322322
alt self {
323323
ii_item(i) { /* FIXME (#2543) */ copy i.ident }
324-
ii_native(i) { /* FIXME (#2543) */ copy i.ident }
324+
ii_foreign(i) { /* FIXME (#2543) */ copy i.ident }
325325
ii_method(_, m) { /* FIXME (#2543) */ copy m.ident }
326326
ii_ctor(_, nm, _, _) { /* FIXME (#2543) */ copy nm }
327327
ii_dtor(_, nm, _, _) { /* FIXME (#2543) */ copy nm }
@@ -331,7 +331,7 @@ impl inlined_item_methods for inlined_item {
331331
fn id() -> ast::node_id {
332332
alt self {
333333
ii_item(i) { i.id }
334-
ii_native(i) { i.id }
334+
ii_foreign(i) { i.id }
335335
ii_method(_, m) { m.id }
336336
ii_ctor(ctor, _, _, _) { ctor.node.id }
337337
ii_dtor(dtor, _, _, _) { dtor.node.id }
@@ -341,7 +341,7 @@ impl inlined_item_methods for inlined_item {
341341
fn accept<E>(e: E, v: visit::vt<E>) {
342342
alt self {
343343
ii_item(i) { v.visit_item(i, e, v) }
344-
ii_native(i) { v.visit_native_item(i, e, v) }
344+
ii_foreign(i) { v.visit_foreign_item(i, e, v) }
345345
ii_method(_, m) { visit::visit_method_helper(m, e, v) }
346346
ii_ctor(ctor, nm, tps, parent_id) {
347347
visit::visit_class_ctor_helper(ctor, nm, tps, parent_id, e, v);
@@ -419,7 +419,7 @@ fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> {
419419
}
420420
},
421421

422-
visit_native_item: fn@(ni: @native_item) {
422+
visit_foreign_item: fn@(ni: @foreign_item) {
423423
vfn(ni.id)
424424
},
425425

0 commit comments

Comments
 (0)