Permalink
Browse files

Switch 'native' to 'extern' (or 'foreign' in some descriptions)

  • Loading branch information...
1 parent 7259195 commit debb7e4641af2ea71cf8733b3f071d614803dcbd @graydon graydon committed Jul 3, 2012
Showing with 249 additions and 249 deletions.
  1. +1 −1 src/fuzzer/fuzzer.rs
  2. +1 −1 src/libcore/arc.rs
  3. +2 −2 src/libcore/cmath.rs
  4. +2 −2 src/libcore/comm.rs
  5. +3 −3 src/libcore/io.rs
  6. +22 −22 src/libcore/libc.rs
  7. +1 −1 src/libcore/logging.rs
  8. +2 −2 src/libcore/os.rs
  9. +1 −1 src/libcore/priv.rs
  10. +2 −2 src/libcore/ptr.rs
  11. +1 −1 src/libcore/rand.rs
  12. +1 −1 src/libcore/run.rs
  13. +3 −3 src/libcore/stackwalk.rs
  14. +4 −4 src/libcore/str.rs
  15. +2 −2 src/libcore/sys.rs
  16. +3 −3 src/libcore/task.rs
  17. +1 −1 src/libcore/unsafe.rs
  18. +4 −4 src/libcore/vec.rs
  19. +5 −5 src/libstd/c_vec.rs
  20. +1 −1 src/libstd/dbg.rs
  21. +1 −1 src/libstd/net_tcp.rs
  22. +1 −1 src/libstd/test.rs
  23. +1 −1 src/libstd/time.rs
  24. +1 −1 src/libstd/unicode.rs
  25. +1 −1 src/libstd/uv_global_loop.rs
  26. +13 −13 src/libstd/uv_ll.rs
  27. +1 −1 src/libsyntax/ast.rs
  28. +1 −1 src/libsyntax/ast_map.rs
  29. +3 −3 src/rustc/back/link.rs
  30. +1 −1 src/rustc/back/rpath.rs
  31. +1 −1 src/rustc/front/intrinsic.rs
  32. +1 −1 src/rustc/lib/llvm.rs
  33. +2 −2 src/rustc/metadata/creader.rs
  34. +5 −5 src/rustc/metadata/decoder.rs
  35. +3 −3 src/rustc/middle/lint.rs
  36. +2 −2 src/rustc/middle/resolve.rs
  37. +2 −2 src/rustc/middle/trans/base.rs
  38. +13 −13 src/rustc/middle/trans/foreign.rs
  39. +2 −2 src/rustc/middle/typeck.rs
  40. +3 −3 src/rustc/middle/typeck/check.rs
  41. +1 −1 src/rustc/middle/typeck/collect.rs
  42. +2 −2 src/rustdoc/attr_pass.rs
  43. +2 −2 src/rustdoc/extract.rs
  44. +3 −3 src/rustdoc/markdown_index_pass.rs
  45. +6 −6 src/rustdoc/markdown_pass.rs
  46. +2 −2 src/rustdoc/page_pass.rs
  47. +2 −2 src/rustdoc/path_pass.rs
  48. +1 −1 src/rustdoc/reexport_pass.rs
  49. +1 −1 src/rustdoc/sort_item_type_pass.rs
  50. +1 −1 src/rustdoc/tystr_pass.rs
  51. +1 −1 src/test/auxiliary/foreign_lib.rs
  52. +2 −2 src/test/auxiliary/test_comm.rs
  53. +1 −1 src/test/bench/shootout-nbody.rs
  54. +1 −1 src/test/compile-fail/bad-main.rs
  55. +1 −1 src/test/compile-fail/bad-var-env-capture-in-block-arg.rs
  56. +2 −2 src/test/compile-fail/block-coerce-no-2.rs
  57. +4 −4 src/test/compile-fail/block-coerce-no.rs
  58. +1 −1 src/test/compile-fail/crust-no-call.rs
  59. +1 −1 src/test/compile-fail/empty-linkname.rs
  60. +1 −1 src/test/compile-fail/empty-linkname2.rs
  61. +1 −1 src/test/compile-fail/{native-unsafe-fn-called.rs → foreign-unsafe-fn-called.rs}
  62. +1 −1 src/test/compile-fail/{native-unsafe-fn.rs → foreign-unsafe-fn.rs}
  63. +1 −1 src/test/compile-fail/nolink-with-link-args.rs
  64. +2 −2 src/test/compile-fail/redundant-link-args.rs
  65. +1 −1 src/test/compile-fail/unsupported-cast.rs
  66. +1 −1 src/test/compile-fail/warn-ctypes-err-attr.rs
  67. +1 −1 src/test/compile-fail/warn-ctypes.rs
  68. +1 −1 src/test/compile-fail/{warn-native-int-types.rs → warn-foreign-int-types.rs}
  69. +1 −1 src/test/run-fail/crust-fail.rs
  70. +1 −1 src/test/run-fail/morestack2.rs
  71. +1 −1 src/test/run-pass/binops.rs
  72. +1 −1 src/test/run-pass/c-stack-as-value.rs
  73. +1 −1 src/test/run-pass/c-stack-returning-int64.rs
  74. +2 −2 src/test/run-pass/class-dtor.rs
  75. +3 −3 src/test/run-pass/conditional-compile.rs
  76. +1 −1 src/test/run-pass/crust-call-deep.rs
  77. +1 −1 src/test/run-pass/crust-call-deep2.rs
  78. +1 −1 src/test/run-pass/crust-call-scrub.rs
  79. +1 −1 src/test/run-pass/crust-call.rs
  80. +1 −1 src/test/run-pass/crust-stress.rs
  81. +1 −1 src/test/run-pass/crust-yield.rs
  82. +1 −1 src/test/run-pass/expr-block-fn.rs
  83. +2 −2 src/test/run-pass/fixed-point-bind-box.rs
  84. +2 −2 src/test/run-pass/fixed-point-bind-unique.rs
  85. +1 −1 src/test/run-pass/fn-bare-assign.rs
  86. +1 −1 src/test/run-pass/fn-bare-spawn.rs
  87. +1 −1 src/test/run-pass/fn-lval.rs
  88. +2 −2 src/test/run-pass/{native-dupe.rs → foreign-dupe.rs}
  89. +1 −1 src/test/run-pass/{native-fn-linkname.rs → foreign-fn-linkname.rs}
  90. +2 −2 src/test/run-pass/{native-lib-path.rs → foreign-lib-path.rs}
  91. 0 src/test/run-pass/{native-mod-src → foreign-mod-src}/inner.rs
  92. 0 src/test/run-pass/{native-mod.rc → foreign-mod.rc}
  93. +1 −1 src/test/run-pass/{native-no-abi.rs → foreign-no-abi.rs}
  94. +9 −0 src/test/run-pass/foreign-src/foreign.rs
  95. +1 −1 src/test/run-pass/{native-struct.rs → foreign-struct.rs}
  96. 0 src/test/run-pass/{native.rc → foreign.rc}
  97. +5 −5 src/test/run-pass/{native2.rs → foreign2.rs}
  98. +1 −1 src/test/run-pass/fun-indirect-call.rs
  99. +4 −4 src/test/run-pass/generic-temporary.rs
  100. +1 −1 src/test/run-pass/hashmap-memory.rs
  101. +1 −1 src/test/run-pass/{import-from-native.rs → import-from-foreign.rs}
  102. +1 −1 src/test/run-pass/import-glob-1.rs
  103. +1 −1 src/test/run-pass/intrinsic-alignment.rs
  104. +1 −1 src/test/run-pass/intrinsic-atomics.rs
  105. +1 −1 src/test/run-pass/intrinsic-frame-address.rs
  106. +1 −1 src/test/run-pass/intrinsic-move-val.rs
  107. +1 −1 src/test/run-pass/issue-1251.rs
  108. +2 −2 src/test/run-pass/issue-1866.rs
  109. +1 −1 src/test/run-pass/issue-2214.rs
  110. +1 −1 src/test/run-pass/issue-506.rs
  111. +5 −5 src/test/run-pass/item-attributes.rs
  112. +1 −1 src/test/run-pass/morestack6.rs
  113. +0 −9 src/test/run-pass/native-src/native.rs
  114. +1 −1 src/test/run-pass/newtype.rs
  115. +1 −1 src/test/run-pass/{nil-decl-in-native.rs → nil-decl-in-foreign.rs}
  116. +1 −1 src/test/run-pass/rec-align-u32.rs
  117. +1 −1 src/test/run-pass/rec-align-u64.rs
  118. +2 −2 src/test/run-pass/resource-generic.rs
  119. +1 −1 src/test/run-pass/rt-sched-1.rs
  120. +1 −1 src/test/run-pass/sendfn-generic-fn.rs
  121. +1 −1 src/test/run-pass/struct-return.rs
  122. +2 −2 src/test/run-pass/tail-cps.rs
  123. +1 −1 src/test/run-pass/type-param.rs
  124. +1 −1 src/test/run-pass/type-params-in-for-each.rs
  125. +1 −1 src/test/run-pass/warn-ctypes-inhibit.rs
  126. +1 −1 src/test/run-pass/x86stdcall.rs
  127. +1 −1 src/test/run-pass/x86stdcall2.rs
View
2 src/fuzzer/fuzzer.rs
@@ -454,7 +454,7 @@ fn content_is_dangerous_to_run(code: str) -> bool {
let dangerous_patterns =
~["xfail-test",
"import", // espeically fs, run
- "native",
+ "extern",
"unsafe",
"log"]; // python --> rust pipe deadlock?
View
2 src/libcore/arc.rs
@@ -9,7 +9,7 @@ export arc, get, clone, shared_arc, get_arc;
export exclusive, methods;
#[abi = "cdecl"]
-native mod rustrt {
+extern mod rustrt {
#[rust_stack]
fn rust_atomic_increment(p: &mut libc::intptr_t)
-> libc::intptr_t;
View
4 src/libcore/cmath.rs
@@ -17,7 +17,7 @@ import libc::c_double;
#[link_name = "m"]
#[abi = "cdecl"]
-native mod c_double {
+extern mod c_double {
// Alpabetically sorted by link_name
@@ -95,7 +95,7 @@ native mod c_double {
#[link_name = "m"]
#[abi = "cdecl"]
-native mod c_float {
+extern mod c_float {
// Alpabetically sorted by link_name
View
4 src/libcore/comm.rs
@@ -258,7 +258,7 @@ enum rust_port {}
type port_id = int;
#[abi = "cdecl"]
-native mod rustrt {
+extern mod rustrt {
fn rust_port_id_send(target_port: port_id, data: *()) -> libc::uintptr_t;
fn new_port(unit_sz: libc::size_t) -> *rust_port;
@@ -280,7 +280,7 @@ native mod rustrt {
}
#[abi = "rust-intrinsic"]
-native mod rusti {
+extern mod rusti {
fn init<T>() -> T;
}
View
6 src/libcore/io.rs
@@ -14,7 +14,7 @@ import libc::consts::os::extra::*;
type fd_t = c_int;
#[abi = "cdecl"]
-native mod rustrt {
+extern mod rustrt {
fn rust_get_stdin() -> *libc::FILE;
fn rust_get_stdout() -> *libc::FILE;
fn rust_get_stderr() -> *libc::FILE;
@@ -377,11 +377,11 @@ impl of writer for fd_t {
}
}
fn seek(_offset: int, _whence: seek_style) {
- #error("need 64-bit native calls for seek, sorry");
+ #error("need 64-bit foreign calls for seek, sorry");
fail;
}
fn tell() -> uint {
- #error("need 64-bit native calls for tell, sorry");
+ #error("need 64-bit foreign calls for tell, sorry");
fail;
}
fn flush() -> int { 0 }
View
44 src/libcore/libc.rs
@@ -731,7 +731,7 @@ mod funcs {
#[nolink]
#[abi = "cdecl"]
- native mod ctype {
+ extern mod ctype {
fn isalnum(c: c_int) -> c_int;
fn isalpha(c: c_int) -> c_int;
fn iscntrl(c: c_int) -> c_int;
@@ -749,7 +749,7 @@ mod funcs {
#[nolink]
#[abi = "cdecl"]
- native mod stdio {
+ extern mod stdio {
fn fopen(filename: *c_char, mode: *c_char) -> *FILE;
fn freopen(filename: *c_char, mode: *c_char,
@@ -793,7 +793,7 @@ mod funcs {
#[nolink]
#[abi = "cdecl"]
- native mod stdlib {
+ extern mod stdlib {
fn abs(i: c_int) -> c_int;
fn labs(i: c_long) -> c_long;
// Omitted: div, ldiv (return type incomplete).
@@ -818,7 +818,7 @@ mod funcs {
#[nolink]
#[abi = "cdecl"]
- native mod string {
+ extern mod string {
fn strcpy(dst: *c_char, src: *c_char) -> *c_char;
fn strncpy(dst: *c_char, src: *c_char, n: size_t) -> *c_char;
@@ -856,7 +856,7 @@ mod funcs {
#[nolink]
#[abi = "cdecl"]
- native mod stat {
+ extern mod stat {
#[link_name = "_chmod"]
fn chmod(path: *c_char, mode: c_int) -> c_int;
@@ -866,7 +866,7 @@ mod funcs {
#[nolink]
#[abi = "cdecl"]
- native mod stdio {
+ extern mod stdio {
#[link_name = "_popen"]
fn popen(command: *c_char, mode: *c_char) -> *FILE;
@@ -882,7 +882,7 @@ mod funcs {
#[nolink]
#[abi = "cdecl"]
- native mod fcntl {
+ extern mod fcntl {
#[link_name = "_open"]
fn open(path: *c_char, oflag: c_int, mode: c_int) -> c_int;
@@ -892,13 +892,13 @@ mod funcs {
#[nolink]
#[abi = "cdecl"]
- native mod dirent {
+ extern mod dirent {
// Not supplied at all.
}
#[nolink]
#[abi = "cdecl"]
- native mod unistd {
+ extern mod unistd {
#[link_name = "_access"]
fn access(path: *c_char, amode: c_int) -> c_int;
@@ -966,7 +966,7 @@ mod funcs {
#[nolink]
#[abi = "cdecl"]
- native mod stat {
+ extern mod stat {
fn chmod(path: *c_char, mode: mode_t) -> c_int;
fn fchmod(fd: c_int, mode: mode_t) -> c_int;
fn mkdir(path: *c_char, mode: mode_t) -> c_int;
@@ -975,7 +975,7 @@ mod funcs {
#[nolink]
#[abi = "cdecl"]
- native mod stdio {
+ extern mod stdio {
fn popen(command: *c_char, mode: *c_char) -> *FILE;
fn pclose(stream: *FILE) -> c_int;
fn fdopen(fd: c_int, mode: *c_char) -> *FILE;
@@ -984,15 +984,15 @@ mod funcs {
#[nolink]
#[abi = "cdecl"]
- native mod fcntl {
+ extern mod fcntl {
fn open(path: *c_char, oflag: c_int, mode: c_int) -> c_int;
fn creat(path: *c_char, mode: mode_t) -> c_int;
fn fcntl(fd: c_int, cmd: c_int) -> c_int;
}
#[nolink]
#[abi = "cdecl"]
- native mod dirent {
+ extern mod dirent {
fn opendir(dirname: *c_char) -> *DIR;
fn closedir(dirp: *DIR) -> c_int;
fn readdir(dirp: *DIR) -> *dirent;
@@ -1003,7 +1003,7 @@ mod funcs {
#[nolink]
#[abi = "cdecl"]
- native mod unistd {
+ extern mod unistd {
fn access(path: *c_char, amode: c_int) -> c_int;
fn alarm(seconds: c_uint) -> c_uint;
fn chdir(dir: *c_char) -> c_int;
@@ -1056,7 +1056,7 @@ mod funcs {
#[nolink]
#[abi = "cdecl"]
- native mod unistd {
+ extern mod unistd {
fn readlink(path: *c_char, buf: *mut c_char,
bufsz: size_t) -> ssize_t;
@@ -1073,7 +1073,7 @@ mod funcs {
#[nolink]
#[abi = "cdecl"]
- native mod wait {
+ extern mod wait {
fn waitpid(pid: pid_t, status: *mut c_int,
options: c_int) -> pid_t;
}
@@ -1082,7 +1082,7 @@ mod funcs {
#[cfg(target_os = "win32")]
mod posix01 {
#[nolink]
- native mod unistd { }
+ extern mod unistd { }
}
@@ -1092,15 +1092,15 @@ mod funcs {
#[cfg(target_os = "freebsd")]
mod posix08 {
#[nolink]
- native mod unistd { }
+ extern mod unistd { }
}
#[cfg(target_os = "macos")]
#[cfg(target_os = "freebsd")]
#[nolink]
#[abi = "cdecl"]
- native mod bsd44 {
+ extern mod bsd44 {
fn sysctl(name: *c_int, namelen: c_uint,
oldp: *mut c_void, oldlenp: *mut size_t,
@@ -1124,7 +1124,7 @@ mod funcs {
#[cfg(target_os = "macos")]
#[nolink]
#[abi = "cdecl"]
- native mod extra {
+ extern mod extra {
fn _NSGetExecutablePath(buf: *mut c_char,
bufsize: *mut u32) -> c_int;
}
@@ -1141,7 +1141,7 @@ mod funcs {
import types::os::arch::extra::*;
#[abi = "stdcall"]
- native mod kernel32 {
+ extern mod kernel32 {
fn GetEnvironmentVariableW(n: LPCWSTR,
v: LPWSTR,
nsize: DWORD) -> DWORD;
@@ -1165,7 +1165,7 @@ mod funcs {
#[abi = "cdecl"]
#[nolink]
- native mod msvcrt {
+ extern mod msvcrt {
#[link_name = "_commit"]
fn commit(fd: c_int) -> c_int;
}
View
2 src/libcore/logging.rs
@@ -3,7 +3,7 @@
export console_on, console_off;
#[nolink]
-native mod rustrt {
+extern mod rustrt {
fn rust_log_console_on();
fn rust_log_console_off();
}
View
4 src/libcore/os.rs
@@ -39,7 +39,7 @@ export walk_dir;
// FIXME: move these to str perhaps? #2620
export as_c_charp, fill_charp_buf;
-native mod rustrt {
+extern mod rustrt {
fn rust_env_pairs() -> ~[str];
fn rust_getcwd() -> str;
fn rust_path_is_dir(path: *libc::c_char) -> c_int;
@@ -135,7 +135,7 @@ mod global_env {
export getenv;
export setenv;
- native mod rustrt {
+ extern mod rustrt {
fn rust_global_env_chan_ptr() -> *libc::uintptr_t;
}
View
2 src/libcore/priv.rs
@@ -6,7 +6,7 @@ import compare_and_swap = rustrt::rust_compare_and_swap_ptr;
type rust_port_id = uint;
-native mod rustrt {
+extern mod rustrt {
fn rust_compare_and_swap_ptr(address: *libc::uintptr_t,
oldval: libc::uintptr_t,
newval: libc::uintptr_t) -> bool;
View
4 src/libcore/ptr.rs
@@ -19,7 +19,7 @@ import libc::{c_void, size_t};
#[nolink]
#[abi = "cdecl"]
-native mod libc_ {
+extern mod libc_ {
#[rust_stack]
fn memcpy(dest: *c_void, src: *c_void, n: libc::size_t) -> *c_void;
#[rust_stack]
@@ -29,7 +29,7 @@ native mod libc_ {
}
#[abi = "rust-intrinsic"]
-native mod rusti {
+extern mod rusti {
fn addr_of<T>(val: T) -> *T;
}
View
2 src/libcore/rand.rs
@@ -6,7 +6,7 @@ export xorshift, seeded_xorshift;
enum rctx {}
#[abi = "cdecl"]
-native mod rustrt {
+extern mod rustrt {
fn rand_seed() -> ~[u8];
fn rand_new() -> *rctx;
fn rand_new_seeded(seed: ~[u8]) -> *rctx;
View
2 src/libcore/run.rs
@@ -10,7 +10,7 @@ export spawn_process;
export waitpid;
#[abi = "cdecl"]
-native mod rustrt {
+extern mod rustrt {
fn rust_run_program(argv: **libc::c_char, envp: *c_void,
dir: *libc::c_char,
in_fd: c_int, out_fd: c_int, err_fd: c_int)
View
6 src/libcore/stackwalk.rs
@@ -34,7 +34,7 @@ fn walk_stack(visit: fn(frame) -> bool) {
if *frame_address == 0u {
#debug("encountered task_start_wrapper. ending walk");
// This is the task_start_wrapper_frame. There is
- // no stack beneath it and it is a native frame.
+ // no stack beneath it and it is a foreign frame.
break;
}
}
@@ -72,11 +72,11 @@ fn frame_address(f: fn(*u8)) {
rusti::frame_address(f)
}
-native mod rustrt {
+extern mod rustrt {
fn rust_dbg_breakpoint();
}
#[abi = "rust-intrinsic"]
-native mod rusti {
+extern mod rusti {
fn frame_address(f: fn(*u8));
}
View
8 src/libcore/str.rs
@@ -106,7 +106,7 @@ export
extensions;
#[abi = "cdecl"]
-native mod rustrt {
+extern mod rustrt {
fn rust_str_push(&s: str, ch: u8);
fn str_reserve_shared(&ss: str, nn: libc::size_t);
}
@@ -1585,7 +1585,7 @@ const tag_six_b: uint = 252u;
#[doc = "
Work with the byte buffer of a string.
-Allows for unsafe manipulation of strings, which is useful for native
+Allows for unsafe manipulation of strings, which is useful for foreign
interop.
# Example
@@ -1604,7 +1604,7 @@ pure fn as_bytes<T>(s: str, f: fn(~[u8]) -> T) -> T {
#[doc = "
Work with the byte buffer of a string.
-Allows for unsafe manipulation of strings, which is useful for native
+Allows for unsafe manipulation of strings, which is useful for foreign
interop.
"]
pure fn as_buf<T>(s: str, f: fn(*u8) -> T) -> T {
@@ -1614,7 +1614,7 @@ pure fn as_buf<T>(s: str, f: fn(*u8) -> T) -> T {
#[doc = "
Work with the byte buffer of a string as a null-terminated C string.
-Allows for unsafe manipulation of strings, which is useful for native
+Allows for unsafe manipulation of strings, which is useful for foreign
interop, without copying the original string.
# Example
View
4 src/libcore/sys.rs
@@ -19,7 +19,7 @@ enum type_desc = {
type rust_cond_lock = *libc::c_void;
#[abi = "cdecl"]
-native mod rustrt {
+extern mod rustrt {
fn unsupervise();
pure fn shape_log_str(t: *sys::type_desc, data: *()) -> str;
@@ -32,7 +32,7 @@ native mod rustrt {
}
#[abi = "rust-intrinsic"]
-native mod rusti {
+extern mod rusti {
fn get_tydesc<T>() -> *();
fn size_of<T>() -> uint;
fn pref_align_of<T>() -> uint;
View
6 src/libcore/task.rs
@@ -609,7 +609,7 @@ type local_data_key<T> = fn@(+@T);
// We use dvec because it's the best data structure in core. If TLS is used
// heavily in future, this could be made more efficient with a proper map.
type task_local_element = (*libc::c_void, *libc::c_void, fn@(+*libc::c_void));
-// Has to be a pointer at the outermost layer; the native call returns void *.
+// Has to be a pointer at outermost layer; the foreign call returns void *.
type task_local_map = @dvec::dvec<option<task_local_element>>;
crust fn cleanup_task_local_map(map_ptr: *libc::c_void) unsafe {
@@ -763,7 +763,7 @@ unsafe fn local_data_modify<T>(key: local_data_key<T>,
local_modify(rustrt::rust_get_task(), key, modify_fn)
}
-native mod rustrt {
+extern mod rustrt {
#[rust_stack]
fn rust_task_yield(task: *rust_task, &killed: bool);
@@ -989,7 +989,7 @@ fn test_spawn_sched_childs_on_same_sched() {
#[nolink]
#[cfg(test)]
-native mod testrt {
+extern mod testrt {
fn rust_dbg_lock_create() -> *libc::c_void;
fn rust_dbg_lock_destroy(lock: *libc::c_void);
fn rust_dbg_lock_lock(lock: *libc::c_void);
View
2 src/libcore/unsafe.rs
@@ -3,7 +3,7 @@
export reinterpret_cast, forget, bump_box_refcount, transmute;
#[abi = "rust-intrinsic"]
-native mod rusti {
+extern mod rusti {
fn forget<T>(-x: T);
fn reinterpret_cast<T, U>(e: T) -> U;
}
View
8 src/libcore/vec.rs
@@ -85,7 +85,7 @@ export u8;
export extensions;
#[abi = "cdecl"]
-native mod rustrt {
+extern mod rustrt {
fn vec_reserve_shared(++t: *sys::type_desc,
++v: **unsafe::vec_repr,
++n: libc::size_t);
@@ -95,7 +95,7 @@ native mod rustrt {
}
#[abi = "rust-intrinsic"]
-native mod rusti {
+extern mod rusti {
fn move_val_init<T>(&dst: T, -src: T);
}
@@ -1125,8 +1125,8 @@ pure fn windowed<TT: copy>(nn: uint, xx: &[TT]) -> ~[~[TT]] {
#[doc = "
Work with the buffer of a vector.
-Allows for unsafe manipulation of vector contents, which is useful for native
-interop.
+Allows for unsafe manipulation of vector contents, which is useful for
+foreign interop.
"]
fn as_buf<E,T>(v: &[E], f: fn(*E) -> T) -> T {
unpack_slice(v, |buf, _len| f(buf))
View
10 src/libstd/c_vec.rs
@@ -32,7 +32,7 @@ export len;
export ptr;
#[doc = "
-The type representing a native chunk of memory
+The type representing a foreign chunk of memory
Wrapped in a enum for opacity; FIXME #818 when it is possible to have
truly opaque types, this should be revisited.
@@ -57,11 +57,11 @@ class dtor_res {
*/
#[doc = "
-Create a `c_vec` from a native buffer with a given length.
+Create a `c_vec` from a foreign buffer with a given length.
# Arguments
-* base - A native pointer to a buffer
+* base - A foreign pointer to a buffer
* len - The number of elements in the buffer
"]
unsafe fn c_vec<T>(base: *mut T, len: uint) -> c_vec<T> {
@@ -73,12 +73,12 @@ unsafe fn c_vec<T>(base: *mut T, len: uint) -> c_vec<T> {
}
#[doc = "
-Create a `c_vec` from a native buffer, with a given length,
+Create a `c_vec` from a foreign buffer, with a given length,
and a function to run upon destruction.
# Arguments
-* base - A native pointer to a buffer
+* base - A foreign pointer to a buffer
* len - The number of elements in the buffer
* dtor - A function to run when the value is destructed, useful
for freeing the buffer, etc.
View
2 src/libstd/dbg.rs
@@ -11,7 +11,7 @@ export ptr_cast;
export breakpoint;
#[abi = "cdecl"]
-native mod rustrt {
+extern mod rustrt {
fn debug_tydesc(td: *sys::type_desc);
fn debug_opaque(td: *sys::type_desc, x: *());
fn debug_box(td: *sys::type_desc, x: *());
View
2 src/libstd/net_tcp.rs
@@ -28,7 +28,7 @@ export listen, accept;
export connect;
#[nolink]
-native mod rustrt {
+extern mod rustrt {
fn rust_uv_current_kernel_malloc(size: libc::c_uint) -> *libc::c_void;
fn rust_uv_current_kernel_free(mem: *libc::c_void);
fn rust_uv_helper_uv_tcp_t_size() -> libc::c_uint;
View
2 src/libstd/test.rs
@@ -22,7 +22,7 @@ export tr_ignored;
export run_tests_console;
#[abi = "cdecl"]
-native mod rustrt {
+extern mod rustrt {
fn sched_threads() -> libc::size_t;
}
View
2 src/libstd/time.rs
@@ -17,7 +17,7 @@ export
strptime;
#[abi = "cdecl"]
-native mod rustrt {
+extern mod rustrt {
fn get_time(&sec: i64, &nsec: i32);
fn precise_time_ns(&ns: u64);
View
2 src/libstd/unicode.rs
@@ -148,7 +148,7 @@ mod icu {
#[link_name = "icuuc"]
#[abi = "cdecl"]
- native mod libicu {
+ extern mod libicu {
pure fn u_hasBinaryProperty(c: UChar32, which: UProperty) -> UBool;
pure fn u_isdigit(c: UChar32) -> UBool;
pure fn u_islower(c: UChar32) -> UBool;
View
2 src/libstd/uv_global_loop.rs
@@ -12,7 +12,7 @@ import priv::{chan_from_global_ptr, weaken_task};
import comm::{port, chan, methods, select2, listen};
import either::{left, right};
-native mod rustrt {
+extern mod rustrt {
fn rust_uv_get_kernel_global_chan_ptr() -> *libc::uintptr_t;
}
View
26 src/libstd/uv_ll.rs
@@ -556,7 +556,7 @@ mod uv_ll_struct_stubgen {
}
#[nolink]
-native mod rustrt {
+extern mod rustrt {
// libuv public API
fn rust_uv_loop_new() -> *libc::c_void;
fn rust_uv_loop_delete(lp: *libc::c_void);
@@ -705,7 +705,7 @@ unsafe fn tcp_connect(connect_ptr: *uv_connect_t,
addr_ptr: *sockaddr_in,
++after_connect_cb: *u8)
-> libc::c_int {
- log(debug, #fmt("b4 native tcp_connect--addr port: %u cb: %u",
+ log(debug, #fmt("b4 foreign tcp_connect--addr port: %u cb: %u",
(*addr_ptr).sin_port as uint, after_connect_cb as uint));
ret rustrt::rust_uv_tcp_connect(connect_ptr, tcp_handle_ptr,
after_connect_cb, addr_ptr);
@@ -1527,7 +1527,7 @@ mod test {
fn test_uv_ll_struct_size_uv_tcp_t() {
let foreign_handle_size = rustrt::rust_uv_helper_uv_tcp_t_size();
let rust_handle_size = sys::size_of::<uv_tcp_t>();
- let output = #fmt("uv_tcp_t -- native: %u rust: %u",
+ let output = #fmt("uv_tcp_t -- foreign: %u rust: %u",
foreign_handle_size as uint, rust_handle_size);
log(debug, output);
assert foreign_handle_size as uint == rust_handle_size;
@@ -1538,7 +1538,7 @@ mod test {
let foreign_handle_size =
rustrt::rust_uv_helper_uv_connect_t_size();
let rust_handle_size = sys::size_of::<uv_connect_t>();
- let output = #fmt("uv_connect_t -- native: %u rust: %u",
+ let output = #fmt("uv_connect_t -- foreign: %u rust: %u",
foreign_handle_size as uint, rust_handle_size);
log(debug, output);
assert foreign_handle_size as uint == rust_handle_size;
@@ -1549,7 +1549,7 @@ mod test {
let foreign_handle_size =
rustrt::rust_uv_helper_uv_buf_t_size();
let rust_handle_size = sys::size_of::<uv_buf_t>();
- let output = #fmt("uv_buf_t -- native: %u rust: %u",
+ let output = #fmt("uv_buf_t -- foreign: %u rust: %u",
foreign_handle_size as uint, rust_handle_size);
log(debug, output);
assert foreign_handle_size as uint == rust_handle_size;
@@ -1560,7 +1560,7 @@ mod test {
let foreign_handle_size =
rustrt::rust_uv_helper_uv_write_t_size();
let rust_handle_size = sys::size_of::<uv_write_t>();
- let output = #fmt("uv_write_t -- native: %u rust: %u",
+ let output = #fmt("uv_write_t -- foreign: %u rust: %u",
foreign_handle_size as uint, rust_handle_size);
log(debug, output);
assert foreign_handle_size as uint == rust_handle_size;
@@ -1572,7 +1572,7 @@ mod test {
let foreign_handle_size =
rustrt::rust_uv_helper_sockaddr_in_size();
let rust_handle_size = sys::size_of::<sockaddr_in>();
- let output = #fmt("sockaddr_in -- native: %u rust: %u",
+ let output = #fmt("sockaddr_in -- foreign: %u rust: %u",
foreign_handle_size as uint, rust_handle_size);
log(debug, output);
assert foreign_handle_size as uint == rust_handle_size;
@@ -1583,7 +1583,7 @@ mod test {
let native_handle_size =
rustrt::rust_uv_helper_sockaddr_in6_size();
let rust_handle_size = sys::size_of::<sockaddr_in6>();
- let output = #fmt("sockaddr_in6 -- native: %u rust: %u",
+ let output = #fmt("sockaddr_in6 -- foreign: %u rust: %u",
native_handle_size as uint, rust_handle_size);
log(debug, output);
// FIXME #1645 .. rust appears to pad structs to the nearest byte..?
@@ -1598,7 +1598,7 @@ mod test {
let native_handle_size =
rustrt::rust_uv_helper_addr_in_size();
let rust_handle_size = sys::size_of::<addr_in>();
- let output = #fmt("addr_in -- native: %u rust: %u",
+ let output = #fmt("addr_in -- foreign: %u rust: %u",
native_handle_size as uint, rust_handle_size);
log(debug, output);
// FIXME #1645 .. see note above about struct padding
@@ -1611,7 +1611,7 @@ mod test {
let foreign_handle_size =
rustrt::rust_uv_helper_uv_async_t_size();
let rust_handle_size = sys::size_of::<uv_async_t>();
- let output = #fmt("uv_async_t -- native: %u rust: %u",
+ let output = #fmt("uv_async_t -- foreign: %u rust: %u",
foreign_handle_size as uint, rust_handle_size);
log(debug, output);
assert foreign_handle_size as uint == rust_handle_size;
@@ -1623,7 +1623,7 @@ mod test {
let foreign_handle_size =
rustrt::rust_uv_helper_uv_timer_t_size();
let rust_handle_size = sys::size_of::<uv_timer_t>();
- let output = #fmt("uv_timer_t -- native: %u rust: %u",
+ let output = #fmt("uv_timer_t -- foreign: %u rust: %u",
foreign_handle_size as uint, rust_handle_size);
log(debug, output);
assert foreign_handle_size as uint == rust_handle_size;
@@ -1636,7 +1636,7 @@ mod test {
let native_handle_size =
rustrt::rust_uv_helper_uv_getaddrinfo_t_size();
let rust_handle_size = sys::size_of::<uv_getaddrinfo_t>();
- let output = #fmt("uv_getaddrinfo_t -- native: %u rust: %u",
+ let output = #fmt("uv_getaddrinfo_t -- foreign: %u rust: %u",
native_handle_size as uint, rust_handle_size);
log(debug, output);
assert native_handle_size as uint == rust_handle_size;
@@ -1649,7 +1649,7 @@ mod test {
let native_handle_size =
rustrt::rust_uv_helper_addrinfo_size();
let rust_handle_size = sys::size_of::<addrinfo>();
- let output = #fmt("addrinfo -- native: %u rust: %u",
+ let output = #fmt("addrinfo -- foreign: %u rust: %u",
native_handle_size as uint, rust_handle_size);
log(debug, output);
assert native_handle_size as uint == rust_handle_size;
View
2 src/libsyntax/ast.rs
@@ -170,7 +170,7 @@ enum mutability { m_mutbl, m_imm, m_const, }
#[auto_serialize]
enum proto {
- proto_bare, // native fn
+ proto_bare, // foreign fn
proto_any, // fn
proto_uniq, // fn~
proto_box, // fn@
View
2 src/libsyntax/ast_map.rs
@@ -270,7 +270,7 @@ fn node_id_to_str(map: map, id: node_id) -> str {
#fmt["item %s (id=%?)", path_ident_to_str(*path, item.ident), id]
}
some(node_foreign_item(item, abi, path)) {
- #fmt["native item %s with abi %? (id=%?)",
+ #fmt["foreign item %s with abi %? (id=%?)",
path_ident_to_str(*path, item.ident), abi, id]
}
some(node_method(m, impl_did, path)) {
View
6 src/rustc/back/link.rs
@@ -609,7 +609,7 @@ fn link_binary(sess: session,
let ula = cstore::get_used_link_args(cstore);
for ula.each |arg| { vec::push(cc_args, arg); }
- // # Native library linking
+ // # Extern library linking
// User-supplied library search paths (-L on the cammand line) These are
// the same paths used to find Rust crates, so some of them may have been
@@ -620,7 +620,7 @@ fn link_binary(sess: session,
let addl_paths = sess.opts.addl_lib_search_paths;
for addl_paths.each |path| { vec::push(cc_args, "-L" + path); }
- // The names of the native libraries
+ // The names of the extern libraries
let used_libs = cstore::get_used_libraries(cstore);
for used_libs.each |l| { vec::push(cc_args, "-l" + l); }
@@ -673,7 +673,7 @@ fn link_binary(sess: session,
vec::push(cc_args, "-lmorestack");
// FIXME (#2397): At some point we want to rpath our guesses as to where
- // native libraries might live, based on the addl_lib_search_paths
+ // extern libraries might live, based on the addl_lib_search_paths
vec::push_all(cc_args, rpath::get_rpath_flags(sess, output));
#debug("%s link args: %s", cc_prog, str::connect(cc_args, " "));
View
2 src/rustc/back/rpath.rs
@@ -27,7 +27,7 @@ fn get_rpath_flags(sess: session::session, out_filename: str) -> ~[str] {
let sysroot = sess.filesearch.sysroot();
let output = out_filename;
let libs = cstore::get_used_crate_files(sess.cstore);
- // We don't currently rpath native libraries, but we know
+ // We don't currently rpath extern libraries, but we know
// where rustrt is and we know every rust program needs it
let libs = vec::append_one(libs, get_sysroot_absolute_rt_lib(sess));
View
2 src/rustc/front/intrinsic.rs
@@ -121,7 +121,7 @@ mod intrinsic {
}
#[abi = "rust-intrinsic"]
- native mod rusti {
+ extern mod rusti {
fn visit_ty<T>(&&tv: ty_visitor);
}
}
View
2 src/rustc/lib/llvm.rs
@@ -191,7 +191,7 @@ type SectionIteratorRef = *SectionIterator_opaque;
#[link_args = "-Lrustllvm"]
#[link_name = "rustllvm"]
#[abi = "cdecl"]
-native mod llvm {
+extern mod llvm {
/* Create and destroy contexts. */
fn LLVMContextCreate() -> ContextRef;
fn LLVMGetGlobalContext() -> ContextRef;
View
4 src/rustc/metadata/creader.rs
@@ -1,6 +1,6 @@
#[doc = "
-Validates all used crates and native libraries and loads their metadata
+Validates all used crates and extern libraries and loads their metadata
"];
@@ -17,7 +17,7 @@ import dvec::{dvec, extensions};
export read_crates;
-// Traverses an AST, reading all the information about use'd crates and native
+// Traverses an AST, reading all the information about use'd crates and extern
// libraries necessary for later resolving, typechecking, linking, etc.
fn read_crates(diag: span_handler, crate: ast::crate,
cstore: cstore::cstore, filesearch: filesearch,
View
10 src/rustc/metadata/decoder.rs
@@ -675,14 +675,14 @@ fn item_family_to_str(fam: char) -> str {
'f' { ret "fn"; }
'u' { ret "unsafe fn"; }
'p' { ret "pure fn"; }
- 'F' { ret "native fn"; }
- 'U' { ret "unsafe native fn"; }
- 'P' { ret "pure native fn"; }
+ 'F' { ret "foreign fn"; }
+ 'U' { ret "unsafe foreign fn"; }
+ 'P' { ret "pure foreign fn"; }
'y' { ret "type"; }
- 'T' { ret "native type"; }
+ 'T' { ret "foreign type"; }
't' { ret "type"; }
'm' { ret "mod"; }
- 'n' { ret "native mod"; }
+ 'n' { ret "foreign mod"; }
'v' { ret "enum"; }
'i' { ret "impl"; }
'I' { ret "iface"; }
View
6 src/rustc/middle/lint.rs
@@ -87,7 +87,7 @@ fn get_lint_dict() -> lint_dict {
let v = ~[
("ctypes",
@{lint: ctypes,
- desc: "proper use of core::libc types in native modules",
+ desc: "proper use of core::libc types in foreign modules",
default: warn}),
("unused_imports",
@@ -368,14 +368,14 @@ fn check_item_ctypes(cx: ty::ctxt, it: @ast::item) {
cx.sess.span_lint(
ctypes, id, fn_id,
ty.span,
- "found rust type `int` in native module, while \
+ "found rust type `int` in foreign module, while \
libc::c_int or libc::c_long should be used");
}
ast::def_prim_ty(ast::ty_uint(ast::ty_u)) {
cx.sess.span_lint(
ctypes, id, fn_id,
ty.span,
- "found rust type `uint` in native module, while \
+ "found rust type `uint` in foreign module, while \
libc::c_uint or libc::c_ulong should be used");
}
_ { }
View
4 src/rustc/middle/resolve.rs
@@ -106,7 +106,7 @@ type indexed_mod = {
path: str
};
-/* native modules can't contain enums, and we don't store their ASTs because
+/* foreign modules can't contain enums, and we don't store their ASTs because
we only need to look at them to determine exports, which they can't
control.*/
@@ -1481,7 +1481,7 @@ fn lookup_in_local_mod(e: env, node_id: node_id, sp: span, id: ident,
module %d not in mod_map", node_id)); }
};
if dr == outside && !is_exported(e, id, inf) {
- // if we're in a native mod, then dr==inside, so inf.m is some _mod
+ // if we're in a foreign mod, then dr==inside, so inf.m is some _mod
ret none; // name is not visible
}
alt inf.index.find(id) {
View
4 src/rustc/middle/trans/base.rs
@@ -4913,7 +4913,7 @@ fn trans_item(ccx: @crate_ctxt, item: ast::item) {
ast::item_fn(decl, tps, body) {
if decl.purity == ast::extern_fn {
let llfndecl = get_item_val(ccx, item.id);
- foreign::trans_extern_fn(ccx,
+ foreign::trans_foreign_fn(ccx,
vec::append(
*path,
~[path_name(item.ident)]),
@@ -5194,7 +5194,7 @@ fn get_item_val(ccx: @crate_ctxt, id: ast::node_id) -> ValueRef {
let llfn = if decl.purity != ast::extern_fn {
register_fn(ccx, i.span, my_path, i.id)
} else {
- foreign::register_extern_fn(ccx, i.span, my_path, i.id)
+ foreign::register_foreign_fn(ccx, i.span, my_path, i.id)
};
set_inline_hint_if_appr(i.attrs, llfn);
llfn
View
26 src/rustc/middle/trans/foreign.rs
@@ -19,7 +19,7 @@ import type_of::*;
import std::map::hashmap;
import util::ppaux::ty_to_str;
-export link_name, trans_foreign_mod, register_extern_fn, trans_extern_fn,
+export link_name, trans_foreign_mod, register_foreign_fn, trans_foreign_fn,
trans_intrinsic;
enum x86_64_reg_class {
@@ -541,15 +541,15 @@ fn build_wrap_fn_(ccx: @crate_ctxt,
Unreachable(ret_cx);
}
-// For each native function F, we generate a wrapper function W and a shim
+// For each foreign function F, we generate a wrapper function W and a shim
// function S that all work together. The wrapper function W is the function
// that other rust code actually invokes. Its job is to marshall the
// arguments into a struct. It then uses a small bit of assembly to switch
// over to the C stack and invoke the shim function. The shim function S then
// unpacks the arguments from the struct and invokes the actual function F
// according to its specified calling convention.
//
-// Example: Given a native c-stack function F(x: X, y: Y) -> Z,
+// Example: Given a foreign c-stack function F(x: X, y: Y) -> Z,
// we generate a wrapper function W that looks like:
//
// void W(Z* dest, void *env, X x, Y y) {
@@ -984,15 +984,15 @@ fn trans_intrinsic(ccx: @crate_ctxt, decl: ValueRef, item: @ast::foreign_item,
finish_fn(fcx, lltop);
}
-fn trans_extern_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
+fn trans_foreign_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
body: ast::blk, llwrapfn: ValueRef, id: ast::node_id) {
- let _icx = ccx.insn_ctxt("foreign::build_extern_fn");
+ let _icx = ccx.insn_ctxt("foreign::build_foreign_fn");
fn build_rust_fn(ccx: @crate_ctxt, path: ast_map::path,
decl: ast::fn_decl, body: ast::blk,
id: ast::node_id) -> ValueRef {
- let _icx = ccx.insn_ctxt("foreign::extern::build_rust_fn");
+ let _icx = ccx.insn_ctxt("foreign::foreign::build_rust_fn");
let t = ty::node_id_to_type(ccx.tcx, id);
let ps = link::mangle_internal_name_by_path(
ccx, vec::append_one(path, ast_map::path_name(@"__rust_abi")));
@@ -1005,7 +1005,7 @@ fn trans_extern_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
fn build_shim_fn(ccx: @crate_ctxt, path: ast_map::path,
llrustfn: ValueRef, tys: @c_stack_tys) -> ValueRef {
- let _icx = ccx.insn_ctxt("foreign::extern::build_shim_fn");
+ let _icx = ccx.insn_ctxt("foreign::foreign::build_shim_fn");
fn build_args(bcx: block, tys: @c_stack_tys,
llargbundle: ValueRef) -> ~[ValueRef] {
@@ -1042,11 +1042,11 @@ fn trans_extern_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
fn build_wrap_fn(ccx: @crate_ctxt, llshimfn: ValueRef,
llwrapfn: ValueRef, tys: @c_stack_tys) {
- let _icx = ccx.insn_ctxt("foreign::extern::build_wrap_fn");
+ let _icx = ccx.insn_ctxt("foreign::foreign::build_wrap_fn");
fn build_args(bcx: block, tys: @c_stack_tys,
llwrapfn: ValueRef, llargbundle: ValueRef) {
- let _icx = bcx.insn_ctxt("foreign::extern::wrap::build_args");
+ let _icx = bcx.insn_ctxt("foreign::foreign::wrap::build_args");
alt tys.x86_64_tys {
option::some(x86_64) {
let mut atys = x86_64.arg_tys;
@@ -1100,7 +1100,7 @@ fn trans_extern_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
fn build_ret(bcx: block, tys: @c_stack_tys,
llargbundle: ValueRef) {
- let _icx = bcx.insn_ctxt("foreign::extern::wrap::build_ret");
+ let _icx = bcx.insn_ctxt("foreign::foreign::wrap::build_ret");
alt tys.x86_64_tys {
option::some(x86_64) {
if x86_64.sret || !tys.ret_def {
@@ -1137,14 +1137,14 @@ fn trans_extern_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
let llrustfn = build_rust_fn(ccx, path, decl, body, id);
// The internal shim function - runs on the Rust stack
let llshimfn = build_shim_fn(ccx, path, llrustfn, tys);
- // The external C function - runs on the C stack
+ // The foreign C function - runs on the C stack
build_wrap_fn(ccx, llshimfn, llwrapfn, tys)
}
-fn register_extern_fn(ccx: @crate_ctxt, sp: span,
+fn register_foreign_fn(ccx: @crate_ctxt, sp: span,
path: ast_map::path, node_id: ast::node_id)
-> ValueRef {
- let _icx = ccx.insn_ctxt("foreign::register_extern_fn");
+ let _icx = ccx.insn_ctxt("foreign::register_foreign_fn");
let t = ty::node_id_to_type(ccx.tcx, node_id);
let (llargtys, llretty, ret_ty) = c_arg_and_ret_lltys(ccx, node_id);
ret if ccx.sess.targ_cfg.arch == arch_x86_64 {
View
4 src/rustc/middle/typeck.rs
@@ -259,8 +259,8 @@ fn check_main_fn_ty(ccx: @crate_ctxt,
if !ok {
tcx.sess.span_err(main_span,
#fmt("Wrong type in main function: found `%s`, \
- expecting `native fn(~[str]) -> ()` \
- or `native fn() -> ()`",
+ expecting `extern fn(~[str]) -> ()` \
+ or `extern fn() -> ()`",
ty_to_str(tcx, main_t)));
}
}
View
6 src/rustc/middle/typeck/check.rs
@@ -403,7 +403,7 @@ fn check_item(ccx: @crate_ctxt, it: @ast::item) {
if (*tpt.bounds).is_not_empty() {
ccx.tcx.sess.span_err(
item.span,
- #fmt["native items may not have type parameters"]);
+ #fmt["foreign items may not have type parameters"]);
}
}
}
@@ -740,8 +740,8 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
// really hard due to the way that expr_bind() is
// written.
fcx.ccx.tcx.sess.span_fatal(sp, "mismatched types: \
- expected function or native \
- function but found "
+ expected function or foreign \
+ function but found "
+ fcx.infcx.ty_to_str(in_fty));
}
};
View
2 src/rustc/middle/typeck/collect.rs
@@ -398,7 +398,7 @@ fn convert(ccx: @crate_ctxt, it: @ast::item) {
}
fn convert_foreign(ccx: @crate_ctxt, i: @ast::foreign_item) {
// As above, this call populates the type table with the converted
- // type of the native item. We simply write it into the node type
+ // type of the foreign item. We simply write it into the node type
// table.
let tpt = ty_of_foreign_item(ccx, i);
alt i.node {
View
4 src/rustdoc/attr_pass.rs
@@ -117,13 +117,13 @@ fn should_extract_top_mod_attributes() {
#[test]
fn should_extract_foreign_mod_attributes() {
- let doc = test::mk_doc("#[doc = \"test\"] native mod a { }");
+ let doc = test::mk_doc("#[doc = \"test\"] extern mod a { }");
assert doc.cratemod().nmods()[0].desc() == some("test");
}
#[test]
fn should_extract_foreign_fn_attributes() {
- let doc = test::mk_doc("native mod a { #[doc = \"test\"] fn a(); }");
+ let doc = test::mk_doc("extern mod a { #[doc = \"test\"] fn a(); }");
assert doc.cratemod().nmods()[0].fns[0].desc() == some("test");
}
View
4 src/rustdoc/extract.rs
@@ -291,13 +291,13 @@ mod test {
#[test]
fn extract_foreign_mods() {
- let doc = mk_doc("native mod a { }");
+ let doc = mk_doc("extern mod a { }");
assert doc.cratemod().nmods()[0].name() == "a";
}
#[test]
fn extract_fns_from_foreign_mods() {
- let doc = mk_doc("native mod a { fn a(); }");
+ let doc = mk_doc("extern mod a { fn a(); }");
assert doc.cratemod().nmods()[0].fns[0].name() == "a";
}
View
6 src/rustdoc/markdown_index_pass.rs
@@ -179,10 +179,10 @@ fn should_index_mod_contents_multi_page() {
fn should_index_foreign_mod_pages() {
let doc = test::mk_doc(
config::doc_per_mod,
- "native mod a { }"
+ "extern mod a { }"
);
assert option::get(doc.cratemod().index).entries[0] == {
- kind: "Native module",
+ kind: "Foreign module",
name: "a",
brief: none,
link: "a.html"
@@ -202,7 +202,7 @@ fn should_add_brief_desc_to_index() {
fn should_index_foreign_mod_contents() {
let doc = test::mk_doc(
config::doc_per_crate,
- "native mod a { fn b(); }"
+ "extern mod a { fn b(); }"
);
assert option::get(doc.cratemod().nmods()[0].index).entries[0] == {
kind: "Function",
View
12 src/rustdoc/markdown_pass.rs
@@ -187,7 +187,7 @@ fn header_kind(doc: doc::itemtag) -> str {
}
}
doc::nmodtag(_) {
- "Native module"
+ "Foreign module"
}
doc::fntag(_) {
"Function"
@@ -414,7 +414,7 @@ fn should_not_write_index_if_no_entries() {
#[test]
fn should_write_index_for_foreign_mods() {
- let markdown = test::render("native mod a { fn a(); }");
+ let markdown = test::render("extern mod a { fn a(); }");
assert str::contains(
markdown,
"\n\n* [Function `a`](#function-a)\n\n"
@@ -435,20 +435,20 @@ fn write_nmod(ctxt: ctxt, doc: doc::nmoddoc) {
#[test]
fn should_write_foreign_mods() {
- let markdown = test::render("#[doc = \"test\"] native mod a { }");
- assert str::contains(markdown, "Native module `a`");
+ let markdown = test::render("#[doc = \"test\"] extern mod a { }");
+ assert str::contains(markdown, "Foreign module `a`");
assert str::contains(markdown, "test");
}
#[test]
fn should_write_foreign_fns() {
- let markdown = test::render("native mod a { #[doc = \"test\"] fn a(); }");
+ let markdown = test::render("extern mod a { #[doc = \"test\"] fn a(); }");
assert str::contains(markdown, "test");
}
#[test]
fn should_write_foreign_fn_headers() {
- let markdown = test::render("native mod a { #[doc = \"test\"] fn a(); }");
+ let markdown = test::render("extern mod a { #[doc = \"test\"] fn a(); }");
assert str::contains(markdown, "## Function `a`");
}
View
4 src/rustdoc/page_pass.rs
@@ -150,13 +150,13 @@ fn should_remove_mods_from_containing_mods() {
#[test]
fn should_make_a_page_for_every_foreign_mod() {
- let doc = test::mk_doc("native mod a { }");
+ let doc = test::mk_doc("extern mod a { }");
assert doc.pages.nmods()[0].name() == "a";
}
#[test]
fn should_remove_foreign_mods_from_containing_mods() {
- let doc = test::mk_doc("native mod a { }");
+ let doc = test::mk_doc("extern mod a { }");
assert vec::is_empty(doc.cratemod().nmods());
}
View
4 src/rustdoc/path_pass.rs
@@ -88,7 +88,7 @@ fn should_record_fn_paths() {
#[test]
fn should_record_foreign_mod_paths() {
- let source = "mod a { native mod b { } }";
+ let source = "mod a { extern mod b { } }";
do astsrv::from_str(source) |srv| {
let doc = extract::from_srv(srv, "");
let doc = run(srv, doc);
@@ -98,7 +98,7 @@ fn should_record_foreign_mod_paths() {
#[test]
fn should_record_foreign_fn_paths() {
- let source = "native mod a { fn b(); }";
+ let source = "extern mod a { fn b(); }";
do astsrv::from_str(source) |srv| {
let doc = extract::from_srv(srv, "");
let doc = run(srv, doc);
View
2 src/rustdoc/reexport_pass.rs
@@ -446,7 +446,7 @@ fn should_duplicate_reexported_impls_crate() {
#[test]
fn should_duplicate_reexported_foreign_fns() {
- let source = "native mod a { fn b(); } \
+ let source = "extern mod a { fn b(); } \
mod c { import a::b; export b; }";
let doc = test::mk_doc(source);
assert doc.cratemod().mods()[0].fns()[0].name() == "b";
View
2 src/rustdoc/sort_item_type_pass.rs
@@ -25,7 +25,7 @@ fn mk_pass() -> pass {
fn test() {
let source =
"mod imod { } \
- native mod inmod { } \
+ extern mod inmod { } \
const iconst: int = 0; \
fn ifn() { } \
enum ienum { ivar } \
View
2 src/rustdoc/tystr_pass.rs
@@ -69,7 +69,7 @@ fn should_add_fn_sig() {
#[test]
fn should_add_foreign_fn_sig() {
- let doc = test::mk_doc("native mod a { fn a<T>() -> int; }");
+ let doc = test::mk_doc("extern mod a { fn a<T>() -> int; }");
assert doc.cratemod().nmods()[0].fns[0].sig == some("fn a<T>() -> int");
}
View
2 src/test/auxiliary/foreign_lib.rs
@@ -1,5 +1,5 @@
#[link(name="foreign_lib", vers="0.0")];
-native mod rustrt {
+extern mod rustrt {
fn last_os_error() -> str;
}
View
4 src/test/auxiliary/test_comm.rs
@@ -87,7 +87,7 @@ enum rust_port {}
type port_id = int;
#[abi = "cdecl"]
-native mod rustrt {
+extern mod rustrt {
fn new_port(unit_sz: libc::size_t) -> *rust_port;
fn del_port(po: *rust_port);
@@ -100,7 +100,7 @@ native mod rustrt {
}
#[abi = "rust-intrinsic"]
-native mod rusti {
+extern mod rusti {
fn init<T>() -> T;
}
View
2 src/test/bench/shootout-nbody.rs
@@ -9,7 +9,7 @@ use std;
// stub. Kind of shocking. Might be able to make it faster still with
// an llvm intrinsic.
#[nolink]
-native mod libc {
+extern mod libc {
fn sqrt(n: float) -> float;
}
View
2 src/test/compile-fail/bad-main.rs
@@ -1,3 +1,3 @@
-// error-pattern:expecting `native fn(~[str])
+// error-pattern:expecting `extern fn(~[str])
fn main(x: int) { }
View
2 src/test/compile-fail/bad-var-env-capture-in-block-arg.rs
@@ -1,6 +1,6 @@
fn main() {
let x = 3;
- fn blah(_a: native fn()) {}
+ fn blah(_a: extern fn()) {}
blah(|| {
log(debug, x); //~ ERROR attempted dynamic environment capture
});
View
4 src/test/compile-fail/block-coerce-no-2.rs
@@ -2,10 +2,10 @@
// other tycons.
fn main() {
- fn f(f: native fn(native fn(native fn()))) {
+ fn f(f: extern fn(extern fn(extern fn()))) {
}
- fn g(f: native fn(fn())) {
+ fn g(f: extern fn(fn())) {
}
f(g);
View
8 src/test/compile-fail/block-coerce-no.rs
@@ -1,10 +1,10 @@
// Make sure that fn-to-block coercion isn't incorrectly lifted over
// other tycons.
-fn coerce(b: fn()) -> native fn() {
- fn lol(f: native fn(fn()) -> native fn(),
- g: fn()) -> native fn() { ret f(g); }
- fn fn_id(f: native fn()) -> native fn() { ret f }
+fn coerce(b: fn()) -> extern fn() {
+ fn lol(f: extern fn(fn()) -> extern fn(),
+ g: fn()) -> extern fn() { ret f(g); }
+ fn fn_id(f: extern fn()) -> extern fn() { ret f }
ret lol(fn_id, b);
//~^ ERROR mismatched types: expected `extern fn(fn()) -> extern fn()`
}
View
2 src/test/compile-fail/crust-no-call.rs
@@ -1,4 +1,4 @@
-// error-pattern:expected function or native function but found *u8
+// error-pattern:expected function or foreign function but found *u8
crust fn f() {
}
View
2 src/test/compile-fail/empty-linkname.rs
@@ -1,5 +1,5 @@
// error-pattern:empty #[link_name] not allowed; use #[nolink].
#[link_name = ""]
-native mod foo {
+extern mod foo {
}
View
2 src/test/compile-fail/empty-linkname2.rs
@@ -3,5 +3,5 @@
#[link_name = ""]
#[nolink]
-native mod foo {
+extern mod foo {
}
View
2 ...t/compile-fail/native-unsafe-fn-called.rs → .../compile-fail/foreign-unsafe-fn-called.rs
@@ -1,7 +1,7 @@
// -*- rust -*-
#[abi = "cdecl"]
-native mod test {
+extern mod test {
unsafe fn free();
}
View
2 src/test/compile-fail/native-unsafe-fn.rs → src/test/compile-fail/foreign-unsafe-fn.rs
@@ -1,7 +1,7 @@
// -*- rust -*-
#[abi = "cdecl"]
-native mod test {
+extern mod test {
unsafe fn free();
}
View
2 src/test/compile-fail/nolink-with-link-args.rs
@@ -6,6 +6,6 @@ the compiler output. */
#[link_args = "aFdEfSeVEEE"]
#[nolink]
-native mod m1 { }
+extern mod m1 { }
fn main() { }
View
4 src/test/compile-fail/redundant-link-args.rs
@@ -8,10 +8,10 @@
#[link_name= "m"]
#[link_args="-foo"] // this could have been elided.
-native mod m1 {
+extern mod m1 {
}
#[link_name= "m"]
#[link_args="-bar"] // this is the actual error trigger.
-native mod m2 {
+extern mod m2 {
}
View
2 src/test/compile-fail/unsupported-cast.rs
@@ -1,5 +1,5 @@
// error-pattern:unsupported cast
fn main() {
- log(debug, 1.0 as *libc::FILE); // Can't cast float to native.
+ log(debug, 1.0 as *libc::FILE); // Can't cast float to foreign.
}
View
2 src/test/compile-fail/warn-ctypes-err-attr.rs
@@ -2,7 +2,7 @@
#[warn(err_ctypes)];
#[nolink]
-native mod libc {
+extern mod libc {
fn malloc(size: int) -> *u8;
}
View
2 src/test/compile-fail/warn-ctypes.rs
@@ -1,7 +1,7 @@
// compile-flags:-W err-ctypes
// error-pattern:found rust type
#[nolink]
-native mod libc {
+extern mod libc {
fn malloc(size: int) -> *u8;
}
View
2 ...est/compile-fail/warn-native-int-types.rs → ...st/compile-fail/warn-foreign-int-types.rs
@@ -1,5 +1,5 @@
//error-pattern:libc::c_int or libc::c_long should be used
-native mod xx {
+extern mod xx {
fn strlen(str: *u8) -> uint;
fn foo(x: int, y: uint);
}