diff --git a/src/fuzzer/fuzzer.rs b/src/fuzzer/fuzzer.rs index d052e0739de..e6a7a9fcfe6 100644 --- a/src/fuzzer/fuzzer.rs +++ b/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? diff --git a/src/libcore/arc.rs b/src/libcore/arc.rs index a498749de16..6b576afe50c 100644 --- a/src/libcore/arc.rs +++ b/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; diff --git a/src/libcore/cmath.rs b/src/libcore/cmath.rs index fbb434d8e4b..de611ab2c0a 100644 --- a/src/libcore/cmath.rs +++ b/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 diff --git a/src/libcore/comm.rs b/src/libcore/comm.rs index 75a21ad5358..baf4e82ecd5 100644 --- a/src/libcore/comm.rs +++ b/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; } diff --git a/src/libcore/io.rs b/src/libcore/io.rs index 8527f58ca6c..08da519a1bc 100644 --- a/src/libcore/io.rs +++ b/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 } diff --git a/src/libcore/libc.rs b/src/libcore/libc.rs index c2679c6956e..4ccc9f2010d 100644 --- a/src/libcore/libc.rs +++ b/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,7 +984,7 @@ 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; @@ -992,7 +992,7 @@ mod funcs { #[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,7 +1092,7 @@ mod funcs { #[cfg(target_os = "freebsd")] mod posix08 { #[nolink] - native mod unistd { } + extern mod unistd { } } @@ -1100,7 +1100,7 @@ mod funcs { #[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; } diff --git a/src/libcore/logging.rs b/src/libcore/logging.rs index 48e3fcc2ff2..261a18f6f7d 100644 --- a/src/libcore/logging.rs +++ b/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(); } diff --git a/src/libcore/os.rs b/src/libcore/os.rs index b945a998084..ec553ad5e2f 100644 --- a/src/libcore/os.rs +++ b/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; } diff --git a/src/libcore/priv.rs b/src/libcore/priv.rs index 8d8ce9a9d72..447c9352dda 100644 --- a/src/libcore/priv.rs +++ b/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; diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index b3eaa3bd16d..b6913f9479e 100644 --- a/src/libcore/ptr.rs +++ b/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(val: T) -> *T; } diff --git a/src/libcore/rand.rs b/src/libcore/rand.rs index 4724c00941c..e004aa32dc7 100644 --- a/src/libcore/rand.rs +++ b/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; diff --git a/src/libcore/run.rs b/src/libcore/run.rs index 7bb3b56fa1b..8481793a8ff 100644 --- a/src/libcore/run.rs +++ b/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) diff --git a/src/libcore/stackwalk.rs b/src/libcore/stackwalk.rs index 4af007b14dd..8964067da0b 100644 --- a/src/libcore/stackwalk.rs +++ b/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)); } diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 3618772027e..b87a575fdef 100644 --- a/src/libcore/str.rs +++ b/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(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(s: str, f: fn(*u8) -> T) -> T { @@ -1614,7 +1614,7 @@ pure fn as_buf(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 diff --git a/src/libcore/sys.rs b/src/libcore/sys.rs index 28ef48240ee..992083c484b 100644 --- a/src/libcore/sys.rs +++ b/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() -> *(); fn size_of() -> uint; fn pref_align_of() -> uint; diff --git a/src/libcore/task.rs b/src/libcore/task.rs index f452e611018..f97a39734b8 100644 --- a/src/libcore/task.rs +++ b/src/libcore/task.rs @@ -609,7 +609,7 @@ type local_data_key = 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>; crust fn cleanup_task_local_map(map_ptr: *libc::c_void) unsafe { @@ -763,7 +763,7 @@ unsafe fn local_data_modify(key: local_data_key, 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); diff --git a/src/libcore/unsafe.rs b/src/libcore/unsafe.rs index 98bfa5bbfc4..a4e4c4fe166 100644 --- a/src/libcore/unsafe.rs +++ b/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(-x: T); fn reinterpret_cast(e: T) -> U; } diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index 66b7ddc6daf..81039ec5521 100644 --- a/src/libcore/vec.rs +++ b/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(&dst: T, -src: T); } @@ -1125,8 +1125,8 @@ pure fn windowed(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(v: &[E], f: fn(*E) -> T) -> T { unpack_slice(v, |buf, _len| f(buf)) diff --git a/src/libstd/c_vec.rs b/src/libstd/c_vec.rs index 02ed63981b9..258bc432da1 100644 --- a/src/libstd/c_vec.rs +++ b/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(base: *mut T, len: uint) -> c_vec { @@ -73,12 +73,12 @@ unsafe fn c_vec(base: *mut T, len: uint) -> c_vec { } #[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. diff --git a/src/libstd/dbg.rs b/src/libstd/dbg.rs index 39746eae55e..be0330e543a 100644 --- a/src/libstd/dbg.rs +++ b/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: *()); diff --git a/src/libstd/net_tcp.rs b/src/libstd/net_tcp.rs index cfae6a3ba13..3c9beb24198 100644 --- a/src/libstd/net_tcp.rs +++ b/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; diff --git a/src/libstd/test.rs b/src/libstd/test.rs index 42ff9f6366a..bbf895840d8 100644 --- a/src/libstd/test.rs +++ b/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; } diff --git a/src/libstd/time.rs b/src/libstd/time.rs index fa1597925bd..ba53bdbf014 100644 --- a/src/libstd/time.rs +++ b/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); diff --git a/src/libstd/unicode.rs b/src/libstd/unicode.rs index c5bfd302305..df2c28be7c9 100644 --- a/src/libstd/unicode.rs +++ b/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; diff --git a/src/libstd/uv_global_loop.rs b/src/libstd/uv_global_loop.rs index aab8040c0a4..611100f61f7 100644 --- a/src/libstd/uv_global_loop.rs +++ b/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; } diff --git a/src/libstd/uv_ll.rs b/src/libstd/uv_ll.rs index ff3ed3b9a6b..d2722998299 100644 --- a/src/libstd/uv_ll.rs +++ b/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::(); - 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::(); - 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::(); - 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::(); - 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::(); - 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::(); - 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::(); - 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::(); - 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::(); - 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::(); - 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::(); - 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; diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 90dbc1a82f2..4dff5261546 100644 --- a/src/libsyntax/ast.rs +++ b/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@ diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index 3b4fe5f91ee..bd910058971 100644 --- a/src/libsyntax/ast_map.rs +++ b/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)) { diff --git a/src/rustc/back/link.rs b/src/rustc/back/link.rs index 5603300e040..33f9f376953 100644 --- a/src/rustc/back/link.rs +++ b/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, " ")); diff --git a/src/rustc/back/rpath.rs b/src/rustc/back/rpath.rs index 55e4ba8d082..2625a244beb 100644 --- a/src/rustc/back/rpath.rs +++ b/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)); diff --git a/src/rustc/front/intrinsic.rs b/src/rustc/front/intrinsic.rs index 6496d8052d4..cfd367bb889 100644 --- a/src/rustc/front/intrinsic.rs +++ b/src/rustc/front/intrinsic.rs @@ -121,7 +121,7 @@ mod intrinsic { } #[abi = "rust-intrinsic"] - native mod rusti { + extern mod rusti { fn visit_ty(&&tv: ty_visitor); } } diff --git a/src/rustc/lib/llvm.rs b/src/rustc/lib/llvm.rs index 60bb9c57f1c..1df423cdbb2 100644 --- a/src/rustc/lib/llvm.rs +++ b/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; diff --git a/src/rustc/metadata/creader.rs b/src/rustc/metadata/creader.rs index 8f920e6bbbe..bb001427121 100644 --- a/src/rustc/metadata/creader.rs +++ b/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, diff --git a/src/rustc/metadata/decoder.rs b/src/rustc/metadata/decoder.rs index 1f8aae87b7c..4d92857375f 100644 --- a/src/rustc/metadata/decoder.rs +++ b/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"; } diff --git a/src/rustc/middle/lint.rs b/src/rustc/middle/lint.rs index b9d716ad229..3c8083e7f76 100644 --- a/src/rustc/middle/lint.rs +++ b/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"); } _ { } diff --git a/src/rustc/middle/resolve.rs b/src/rustc/middle/resolve.rs index 143901a9ead..330a5dac383 100644 --- a/src/rustc/middle/resolve.rs +++ b/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) { diff --git a/src/rustc/middle/trans/base.rs b/src/rustc/middle/trans/base.rs index a3707786363..457ffd8e401 100644 --- a/src/rustc/middle/trans/base.rs +++ b/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 diff --git a/src/rustc/middle/trans/foreign.rs b/src/rustc/middle/trans/foreign.rs index 240d739b722..70464930fe6 100644 --- a/src/rustc/middle/trans/foreign.rs +++ b/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,7 +541,7 @@ 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 @@ -549,7 +549,7 @@ fn build_wrap_fn_(ccx: @crate_ctxt, // 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 { diff --git a/src/rustc/middle/typeck.rs b/src/rustc/middle/typeck.rs index 500c469bdac..92fbac20885 100644 --- a/src/rustc/middle/typeck.rs +++ b/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))); } } diff --git a/src/rustc/middle/typeck/check.rs b/src/rustc/middle/typeck/check.rs index ef0815927e4..31bd88e8561 100644 --- a/src/rustc/middle/typeck/check.rs +++ b/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)); } }; diff --git a/src/rustc/middle/typeck/collect.rs b/src/rustc/middle/typeck/collect.rs index a713ae67548..f64cfed7c81 100644 --- a/src/rustc/middle/typeck/collect.rs +++ b/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 { diff --git a/src/rustdoc/attr_pass.rs b/src/rustdoc/attr_pass.rs index 0a00a5ef58c..d2afba56f28 100644 --- a/src/rustdoc/attr_pass.rs +++ b/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"); } diff --git a/src/rustdoc/extract.rs b/src/rustdoc/extract.rs index 66585d5683e..0d4182a6ee8 100644 --- a/src/rustdoc/extract.rs +++ b/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"; } diff --git a/src/rustdoc/markdown_index_pass.rs b/src/rustdoc/markdown_index_pass.rs index 25691cb79d9..83098ecd045 100644 --- a/src/rustdoc/markdown_index_pass.rs +++ b/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", diff --git a/src/rustdoc/markdown_pass.rs b/src/rustdoc/markdown_pass.rs index a616897f3b2..cb3da77362d 100644 --- a/src/rustdoc/markdown_pass.rs +++ b/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`"); } diff --git a/src/rustdoc/page_pass.rs b/src/rustdoc/page_pass.rs index 80af8f2553f..a360686e358 100644 --- a/src/rustdoc/page_pass.rs +++ b/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()); } diff --git a/src/rustdoc/path_pass.rs b/src/rustdoc/path_pass.rs index 99be48c0362..07029029c6e 100644 --- a/src/rustdoc/path_pass.rs +++ b/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); diff --git a/src/rustdoc/reexport_pass.rs b/src/rustdoc/reexport_pass.rs index a998faeac31..3c28501aa98 100644 --- a/src/rustdoc/reexport_pass.rs +++ b/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"; diff --git a/src/rustdoc/sort_item_type_pass.rs b/src/rustdoc/sort_item_type_pass.rs index 7536da57150..de74f2f535e 100644 --- a/src/rustdoc/sort_item_type_pass.rs +++ b/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 } \ diff --git a/src/rustdoc/tystr_pass.rs b/src/rustdoc/tystr_pass.rs index 69b86bff19b..7de5f48db32 100644 --- a/src/rustdoc/tystr_pass.rs +++ b/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() -> int; }"); + let doc = test::mk_doc("extern mod a { fn a() -> int; }"); assert doc.cratemod().nmods()[0].fns[0].sig == some("fn a() -> int"); } diff --git a/src/test/auxiliary/foreign_lib.rs b/src/test/auxiliary/foreign_lib.rs index 16eb4f9589f..ff4bb5266ec 100644 --- a/src/test/auxiliary/foreign_lib.rs +++ b/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; } \ No newline at end of file diff --git a/src/test/auxiliary/test_comm.rs b/src/test/auxiliary/test_comm.rs index 50553fbdacf..62389aece6a 100644 --- a/src/test/auxiliary/test_comm.rs +++ b/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; } diff --git a/src/test/bench/shootout-nbody.rs b/src/test/bench/shootout-nbody.rs index aa9d411f2b6..56b01325b24 100644 --- a/src/test/bench/shootout-nbody.rs +++ b/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; } diff --git a/src/test/compile-fail/bad-main.rs b/src/test/compile-fail/bad-main.rs index e616a05eabe..79f21dc62c3 100644 --- a/src/test/compile-fail/bad-main.rs +++ b/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) { } diff --git a/src/test/compile-fail/bad-var-env-capture-in-block-arg.rs b/src/test/compile-fail/bad-var-env-capture-in-block-arg.rs index 898c164e9dc..e7786129472 100644 --- a/src/test/compile-fail/bad-var-env-capture-in-block-arg.rs +++ b/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 }); diff --git a/src/test/compile-fail/block-coerce-no-2.rs b/src/test/compile-fail/block-coerce-no-2.rs index 780a91b664c..9726dc9b4c9 100644 --- a/src/test/compile-fail/block-coerce-no-2.rs +++ b/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); diff --git a/src/test/compile-fail/block-coerce-no.rs b/src/test/compile-fail/block-coerce-no.rs index e789775fe7d..dd8f77ce20e 100644 --- a/src/test/compile-fail/block-coerce-no.rs +++ b/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()` } diff --git a/src/test/compile-fail/crust-no-call.rs b/src/test/compile-fail/crust-no-call.rs index d6a3fffb754..61d8c25459a 100644 --- a/src/test/compile-fail/crust-no-call.rs +++ b/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() { } diff --git a/src/test/compile-fail/empty-linkname.rs b/src/test/compile-fail/empty-linkname.rs index 1e04913884b..0b6cd08d6bc 100644 --- a/src/test/compile-fail/empty-linkname.rs +++ b/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 { } diff --git a/src/test/compile-fail/empty-linkname2.rs b/src/test/compile-fail/empty-linkname2.rs index 567208f7897..2c87c7308e2 100644 --- a/src/test/compile-fail/empty-linkname2.rs +++ b/src/test/compile-fail/empty-linkname2.rs @@ -3,5 +3,5 @@ #[link_name = ""] #[nolink] -native mod foo { +extern mod foo { } diff --git a/src/test/compile-fail/native-unsafe-fn-called.rs b/src/test/compile-fail/foreign-unsafe-fn-called.rs similarity index 90% rename from src/test/compile-fail/native-unsafe-fn-called.rs rename to src/test/compile-fail/foreign-unsafe-fn-called.rs index b24a4cf6918..c5c80d3a852 100644 --- a/src/test/compile-fail/native-unsafe-fn-called.rs +++ b/src/test/compile-fail/foreign-unsafe-fn-called.rs @@ -1,7 +1,7 @@ // -*- rust -*- #[abi = "cdecl"] -native mod test { +extern mod test { unsafe fn free(); } diff --git a/src/test/compile-fail/native-unsafe-fn.rs b/src/test/compile-fail/foreign-unsafe-fn.rs similarity index 90% rename from src/test/compile-fail/native-unsafe-fn.rs rename to src/test/compile-fail/foreign-unsafe-fn.rs index fd2ace23457..f0619e107bd 100644 --- a/src/test/compile-fail/native-unsafe-fn.rs +++ b/src/test/compile-fail/foreign-unsafe-fn.rs @@ -1,7 +1,7 @@ // -*- rust -*- #[abi = "cdecl"] -native mod test { +extern mod test { unsafe fn free(); } diff --git a/src/test/compile-fail/nolink-with-link-args.rs b/src/test/compile-fail/nolink-with-link-args.rs index 07efff7571c..713c8033a0e 100644 --- a/src/test/compile-fail/nolink-with-link-args.rs +++ b/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() { } \ No newline at end of file diff --git a/src/test/compile-fail/redundant-link-args.rs b/src/test/compile-fail/redundant-link-args.rs index ca06125880e..6a316886fe0 100644 --- a/src/test/compile-fail/redundant-link-args.rs +++ b/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 { } diff --git a/src/test/compile-fail/unsupported-cast.rs b/src/test/compile-fail/unsupported-cast.rs index 3559df78b7d..319d17e1441 100644 --- a/src/test/compile-fail/unsupported-cast.rs +++ b/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. } diff --git a/src/test/compile-fail/warn-ctypes-err-attr.rs b/src/test/compile-fail/warn-ctypes-err-attr.rs index 1c6966324fc..8ee712cb96f 100644 --- a/src/test/compile-fail/warn-ctypes-err-attr.rs +++ b/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; } diff --git a/src/test/compile-fail/warn-ctypes.rs b/src/test/compile-fail/warn-ctypes.rs index 4056f1dbdb4..bfa1057a1f9 100644 --- a/src/test/compile-fail/warn-ctypes.rs +++ b/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; } diff --git a/src/test/compile-fail/warn-native-int-types.rs b/src/test/compile-fail/warn-foreign-int-types.rs similarity index 92% rename from src/test/compile-fail/warn-native-int-types.rs rename to src/test/compile-fail/warn-foreign-int-types.rs index 70c9e724f0d..4ff7d0edf05 100644 --- a/src/test/compile-fail/warn-native-int-types.rs +++ b/src/test/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); } diff --git a/src/test/run-fail/crust-fail.rs b/src/test/run-fail/crust-fail.rs index 8dac4036c0a..a5929248aaf 100644 --- a/src/test/run-fail/crust-fail.rs +++ b/src/test/run-fail/crust-fail.rs @@ -2,7 +2,7 @@ // Testing that runtime failure doesn't cause callbacks to abort abnormally. // Instead the failure will be delivered after the callbacks return. -native mod rustrt { +extern mod rustrt { fn rust_dbg_call(cb: *u8, data: libc::uintptr_t) -> libc::uintptr_t; } diff --git a/src/test/run-fail/morestack2.rs b/src/test/run-fail/morestack2.rs index 9ecc3c6a07b..0fce54cb821 100644 --- a/src/test/run-fail/morestack2.rs +++ b/src/test/run-fail/morestack2.rs @@ -7,7 +7,7 @@ use std; -native mod rustrt { +extern mod rustrt { fn last_os_error() -> str; } diff --git a/src/test/run-pass/binops.rs b/src/test/run-pass/binops.rs index 155195b0428..7bae808504b 100644 --- a/src/test/run-pass/binops.rs +++ b/src/test/run-pass/binops.rs @@ -115,7 +115,7 @@ fn test_fn() { #[abi = "cdecl"] #[nolink] -native mod test { +extern mod test { fn unsupervise(); fn get_task_id(); } diff --git a/src/test/run-pass/c-stack-as-value.rs b/src/test/run-pass/c-stack-as-value.rs index e9de12921d3..1b10798166d 100644 --- a/src/test/run-pass/c-stack-as-value.rs +++ b/src/test/run-pass/c-stack-as-value.rs @@ -1,5 +1,5 @@ #[abi = "cdecl"] -native mod rustrt { +extern mod rustrt { fn unsupervise(); } diff --git a/src/test/run-pass/c-stack-returning-int64.rs b/src/test/run-pass/c-stack-returning-int64.rs index 162657d4190..4c7c2af982b 100644 --- a/src/test/run-pass/c-stack-returning-int64.rs +++ b/src/test/run-pass/c-stack-returning-int64.rs @@ -3,7 +3,7 @@ import str; #[abi = "cdecl"] #[nolink] -native mod libc { +extern mod libc { fn atol(x: *u8) -> int; fn atoll(x: *u8) -> i64; } diff --git a/src/test/run-pass/class-dtor.rs b/src/test/run-pass/class-dtor.rs index 8c539cd8328..f7d113cdbfc 100644 --- a/src/test/run-pass/class-dtor.rs +++ b/src/test/run-pass/class-dtor.rs @@ -1,7 +1,7 @@ class cat { - let done : native fn(uint); + let done : extern fn(uint); let meows : uint; - new(done: native fn(uint)) { + new(done: extern fn(uint)) { self.meows = 0u; self.done = done; } diff --git a/src/test/run-pass/conditional-compile.rs b/src/test/run-pass/conditional-compile.rs index 70cf440949d..d1510e8de47 100644 --- a/src/test/run-pass/conditional-compile.rs +++ b/src/test/run-pass/conditional-compile.rs @@ -5,14 +5,14 @@ const b: bool = true; #[cfg(bogus)] #[abi = "cdecl"] -native mod rustrt { +extern mod rustrt { // This symbol doesn't exist and would be a link error if this // module was translated fn bogus(); } #[abi = "cdecl"] -native mod rustrt { } +extern mod rustrt { } #[cfg(bogus)] type t = int; @@ -81,7 +81,7 @@ fn test_in_fn_ctxt() { mod test_foreign_items { #[abi = "cdecl"] - native mod rustrt { + extern mod rustrt { #[cfg(bogus)] fn vec_from_buf_shared(); fn vec_from_buf_shared(); diff --git a/src/test/run-pass/crust-call-deep.rs b/src/test/run-pass/crust-call-deep.rs index 5a8a9fb285c..e3eb85a1a99 100644 --- a/src/test/run-pass/crust-call-deep.rs +++ b/src/test/run-pass/crust-call-deep.rs @@ -1,4 +1,4 @@ -native mod rustrt { +extern mod rustrt { fn rust_dbg_call(cb: *u8, data: libc::uintptr_t) -> libc::uintptr_t; } diff --git a/src/test/run-pass/crust-call-deep2.rs b/src/test/run-pass/crust-call-deep2.rs index ff6ee8ec35a..a4aa0dba441 100644 --- a/src/test/run-pass/crust-call-deep2.rs +++ b/src/test/run-pass/crust-call-deep2.rs @@ -1,4 +1,4 @@ -native mod rustrt { +extern mod rustrt { fn rust_dbg_call(cb: *u8, data: libc::uintptr_t) -> libc::uintptr_t; } diff --git a/src/test/run-pass/crust-call-scrub.rs b/src/test/run-pass/crust-call-scrub.rs index 3b2d0a4ba29..fe94af2b2e6 100644 --- a/src/test/run-pass/crust-call-scrub.rs +++ b/src/test/run-pass/crust-call-scrub.rs @@ -2,7 +2,7 @@ // make sure the stack pointers are maintained properly in both // directions -native mod rustrt { +extern mod rustrt { fn rust_dbg_call(cb: *u8, data: libc::uintptr_t) -> libc::uintptr_t; } diff --git a/src/test/run-pass/crust-call.rs b/src/test/run-pass/crust-call.rs index f81c0d302f0..1a4c7bce2a5 100644 --- a/src/test/run-pass/crust-call.rs +++ b/src/test/run-pass/crust-call.rs @@ -1,4 +1,4 @@ -native mod rustrt { +extern mod rustrt { fn rust_dbg_call(cb: *u8, data: libc::uintptr_t) -> libc::uintptr_t; } diff --git a/src/test/run-pass/crust-stress.rs b/src/test/run-pass/crust-stress.rs index 170dffdeb5e..fa28dc7217a 100644 --- a/src/test/run-pass/crust-stress.rs +++ b/src/test/run-pass/crust-stress.rs @@ -1,7 +1,7 @@ // This creates a bunch of yielding tasks that run concurrently // while holding onto C stacks -native mod rustrt { +extern mod rustrt { fn rust_dbg_call(cb: *u8, data: libc::uintptr_t) -> libc::uintptr_t; } diff --git a/src/test/run-pass/crust-yield.rs b/src/test/run-pass/crust-yield.rs index d6d6e9b0bd2..6d5da38ef31 100644 --- a/src/test/run-pass/crust-yield.rs +++ b/src/test/run-pass/crust-yield.rs @@ -1,4 +1,4 @@ -native mod rustrt { +extern mod rustrt { fn rust_dbg_call(cb: *u8, data: libc::uintptr_t) -> libc::uintptr_t; } diff --git a/src/test/run-pass/expr-block-fn.rs b/src/test/run-pass/expr-block-fn.rs index 19be1e81b66..9fbe930b7f7 100644 --- a/src/test/run-pass/expr-block-fn.rs +++ b/src/test/run-pass/expr-block-fn.rs @@ -1,7 +1,7 @@ fn test_fn() { - type t = native fn() -> int; + type t = extern fn() -> int; fn ten() -> int { ret 10; } let rs: t = { ten }; assert (rs() == 10); diff --git a/src/test/run-pass/fixed-point-bind-box.rs b/src/test/run-pass/fixed-point-bind-box.rs index a9d0e3e077d..7f1a983ce7b 100644 --- a/src/test/run-pass/fixed-point-bind-box.rs +++ b/src/test/run-pass/fixed-point-bind-box.rs @@ -1,8 +1,8 @@ -fn fix_help(f: native fn(fn@(A) -> B, A) -> B, x: A) -> B { +fn fix_help(f: extern fn(fn@(A) -> B, A) -> B, x: A) -> B { ret f({|a|fix_help(f, a)}, x); } -fn fix(f: native fn(fn@(A) -> B, A) -> B) -> fn@(A) -> B { +fn fix(f: extern fn(fn@(A) -> B, A) -> B) -> fn@(A) -> B { ret {|a|fix_help(f, a)}; } diff --git a/src/test/run-pass/fixed-point-bind-unique.rs b/src/test/run-pass/fixed-point-bind-unique.rs index 75315243a74..be9354d015a 100644 --- a/src/test/run-pass/fixed-point-bind-unique.rs +++ b/src/test/run-pass/fixed-point-bind-unique.rs @@ -1,8 +1,8 @@ -fn fix_help(f: native fn(fn@(A) -> B, A) -> B, x: A) -> B { +fn fix_help(f: extern fn(fn@(A) -> B, A) -> B, x: A) -> B { ret f({|a|fix_help(f, a)}, x); } -fn fix(f: native fn(fn@(A) -> B, A) -> B) -> fn@(A) -> B { +fn fix(f: extern fn(fn@(A) -> B, A) -> B) -> fn@(A) -> B { ret {|a|fix_help(f, a)}; } diff --git a/src/test/run-pass/fn-bare-assign.rs b/src/test/run-pass/fn-bare-assign.rs index 1b5504e8b86..ea1e0ee7e37 100644 --- a/src/test/run-pass/fn-bare-assign.rs +++ b/src/test/run-pass/fn-bare-assign.rs @@ -3,7 +3,7 @@ fn f(i: int, &called: bool) { called = true; } -fn g(f: native fn(int, &bool), &called: bool) { +fn g(f: extern fn(int, &bool), &called: bool) { f(10, called); } diff --git a/src/test/run-pass/fn-bare-spawn.rs b/src/test/run-pass/fn-bare-spawn.rs index e05ceb809b8..4ad9b5090cc 100644 --- a/src/test/run-pass/fn-bare-spawn.rs +++ b/src/test/run-pass/fn-bare-spawn.rs @@ -1,6 +1,6 @@ // This is what the signature to spawn should look like with bare functions -fn spawn(val: T, f: native fn(T)) { +fn spawn(val: T, f: extern fn(T)) { f(val); } diff --git a/src/test/run-pass/fn-lval.rs b/src/test/run-pass/fn-lval.rs index 6cf3cc456da..bc3eae6e707 100644 --- a/src/test/run-pass/fn-lval.rs +++ b/src/test/run-pass/fn-lval.rs @@ -2,7 +2,7 @@ // -*- rust -*- -fn foo(f: native fn(int) -> int) { } +fn foo(f: extern fn(int) -> int) { } fn id(x: int) -> int { ret x; } diff --git a/src/test/run-pass/native-dupe.rs b/src/test/run-pass/foreign-dupe.rs similarity index 89% rename from src/test/run-pass/native-dupe.rs rename to src/test/run-pass/foreign-dupe.rs index 139189f4b9c..ab6a7320e45 100644 --- a/src/test/run-pass/native-dupe.rs +++ b/src/test/run-pass/foreign-dupe.rs @@ -3,13 +3,13 @@ #[abi = "cdecl"] #[link_name = "rustrt"] -native mod rustrt1 { +extern mod rustrt1 { fn last_os_error() -> str; } #[abi = "cdecl"] #[link_name = "rustrt"] -native mod rustrt2 { +extern mod rustrt2 { fn last_os_error() -> str; } diff --git a/src/test/run-pass/native-fn-linkname.rs b/src/test/run-pass/foreign-fn-linkname.rs similarity index 95% rename from src/test/run-pass/native-fn-linkname.rs rename to src/test/run-pass/foreign-fn-linkname.rs index e25b34e4fd3..46fa8cf97cd 100644 --- a/src/test/run-pass/native-fn-linkname.rs +++ b/src/test/run-pass/foreign-fn-linkname.rs @@ -5,7 +5,7 @@ import str; #[nolink] #[abi = "cdecl"] -native mod libc { +extern mod libc { #[link_name = "strlen"] fn my_strlen(str: *u8) -> uint; } diff --git a/src/test/run-pass/native-lib-path.rs b/src/test/run-pass/foreign-lib-path.rs similarity index 80% rename from src/test/run-pass/native-lib-path.rs rename to src/test/run-pass/foreign-lib-path.rs index 288be15c385..99bf3c714f9 100644 --- a/src/test/run-pass/native-lib-path.rs +++ b/src/test/run-pass/foreign-lib-path.rs @@ -1,11 +1,11 @@ // xfail-test FIXME I don't know how to test this (#2604) // compile-flags:-L. -// The -L flag is also used for linking native libraries +// The -L flag is also used for linking foreign libraries // FIXME: I want to name a mod that would not link successfully // wouthout providing a -L argument to the compiler, and that // will also be found successfully at runtime. -native mod WHATGOESHERE { +extern mod WHATGOESHERE { fn IDONTKNOW() -> u32; } diff --git a/src/test/run-pass/native-mod-src/inner.rs b/src/test/run-pass/foreign-mod-src/inner.rs similarity index 100% rename from src/test/run-pass/native-mod-src/inner.rs rename to src/test/run-pass/foreign-mod-src/inner.rs diff --git a/src/test/run-pass/native-mod.rc b/src/test/run-pass/foreign-mod.rc similarity index 100% rename from src/test/run-pass/native-mod.rc rename to src/test/run-pass/foreign-mod.rc diff --git a/src/test/run-pass/native-no-abi.rs b/src/test/run-pass/foreign-no-abi.rs similarity index 82% rename from src/test/run-pass/native-no-abi.rs rename to src/test/run-pass/foreign-no-abi.rs index 615a139300e..6b853b7d0d2 100644 --- a/src/test/run-pass/native-no-abi.rs +++ b/src/test/run-pass/foreign-no-abi.rs @@ -1,6 +1,6 @@ // ABI is cdecl by default -native mod rustrt { +extern mod rustrt { fn unsupervise(); } diff --git a/src/test/run-pass/foreign-src/foreign.rs b/src/test/run-pass/foreign-src/foreign.rs new file mode 100644 index 00000000000..b8ecacaa695 --- /dev/null +++ b/src/test/run-pass/foreign-src/foreign.rs @@ -0,0 +1,9 @@ + + + +// -*- rust -*- +fn main() { + libc.puts(rustrt.str_buf("hello, extern world 1")); + libc.puts(rustrt.str_buf("hello, extern world 2")); + libc.puts(rustrt.str_buf("hello, extern world 3")); +} diff --git a/src/test/run-pass/native-struct.rs b/src/test/run-pass/foreign-struct.rs similarity index 83% rename from src/test/run-pass/native-struct.rs rename to src/test/run-pass/foreign-struct.rs index 8f8ddae2a5f..f88f47dd981 100644 --- a/src/test/run-pass/native-struct.rs +++ b/src/test/run-pass/foreign-struct.rs @@ -4,7 +4,7 @@ enum void { } #[nolink] -native mod bindgen { +extern mod bindgen { fn printf(++v: void); } diff --git a/src/test/run-pass/native.rc b/src/test/run-pass/foreign.rc similarity index 100% rename from src/test/run-pass/native.rc rename to src/test/run-pass/foreign.rc diff --git a/src/test/run-pass/native2.rs b/src/test/run-pass/foreign2.rs similarity index 74% rename from src/test/run-pass/native2.rs rename to src/test/run-pass/foreign2.rs index 377d7310375..b801051d4f6 100644 --- a/src/test/run-pass/native2.rs +++ b/src/test/run-pass/foreign2.rs @@ -1,27 +1,27 @@ #[abi = "cdecl"] -native mod rustrt { +extern mod rustrt { fn unsupervise(); } #[abi = "cdecl"] #[nolink] -native mod bar { } +extern mod bar { } #[abi = "cdecl"] #[nolink] -native mod zed { } +extern mod zed { } #[abi = "cdecl"] #[nolink] -native mod libc { +extern mod libc { fn write(fd: int, buf: *u8, count: core::libc::size_t) -> core::libc::ssize_t; } #[abi = "cdecl"] #[nolink] -native mod baz { } +extern mod baz { } fn main(args: ~[str]) { } diff --git a/src/test/run-pass/fun-indirect-call.rs b/src/test/run-pass/fun-indirect-call.rs index c97411fe5b1..e89378fe1b5 100644 --- a/src/test/run-pass/fun-indirect-call.rs +++ b/src/test/run-pass/fun-indirect-call.rs @@ -5,7 +5,7 @@ fn f() -> int { ret 42; } fn main() { - let g: native fn() -> int = f; + let g: extern fn() -> int = f; let i: int = g(); assert (i == 42); } diff --git a/src/test/run-pass/generic-temporary.rs b/src/test/run-pass/generic-temporary.rs index 108f9f8e34b..29a1a4482f7 100644 --- a/src/test/run-pass/generic-temporary.rs +++ b/src/test/run-pass/generic-temporary.rs @@ -4,13 +4,13 @@ fn mk() -> int { ret 1; } fn chk(&&a: int) { log(debug, a); assert (a == 1); } -fn apply(produce: native fn() -> T, - consume: native fn(T)) { +fn apply(produce: extern fn() -> T, + consume: extern fn(T)) { consume(produce()); } fn main() { - let produce: native fn() -> int = mk; - let consume: native fn(&&int) = chk; + let produce: extern fn() -> int = mk; + let consume: extern fn(&&int) = chk; apply::(produce, consume); } diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs index 0d59e7d1e34..212a6febef5 100644 --- a/src/test/run-pass/hashmap-memory.rs +++ b/src/test/run-pass/hashmap-memory.rs @@ -29,7 +29,7 @@ mod map_reduce { type putter = fn@(str, str); - type mapper = native fn(str, putter); + type mapper = extern fn(str, putter); enum ctrl_proto { find_reducer(~[u8], chan), mapper_done, } diff --git a/src/test/run-pass/import-from-native.rs b/src/test/run-pass/import-from-foreign.rs similarity index 89% rename from src/test/run-pass/import-from-native.rs rename to src/test/run-pass/import-from-foreign.rs index af191426820..51cd4ea4984 100644 --- a/src/test/run-pass/import-from-native.rs +++ b/src/test/run-pass/import-from-foreign.rs @@ -4,7 +4,7 @@ mod spam { } #[abi = "cdecl"] -native mod rustrt { +extern mod rustrt { import spam::{ham, eggs}; export ham; export eggs; diff --git a/src/test/run-pass/import-glob-1.rs b/src/test/run-pass/import-glob-1.rs index 5542f3b633a..6415836988b 100644 --- a/src/test/run-pass/import-glob-1.rs +++ b/src/test/run-pass/import-glob-1.rs @@ -22,7 +22,7 @@ mod a2 { // | | | #[abi = "cdecl"] #[nolink] - native mod b1 { + extern mod b1 { // | | | import a1::b2::*; // | <-/ -/ diff --git a/src/test/run-pass/intrinsic-alignment.rs b/src/test/run-pass/intrinsic-alignment.rs index bc1d75172f0..d379693de8c 100644 --- a/src/test/run-pass/intrinsic-alignment.rs +++ b/src/test/run-pass/intrinsic-alignment.rs @@ -1,7 +1,7 @@ // xfail-fast Does not work with main in a submodule #[abi = "rust-intrinsic"] -native mod rusti { +extern mod rusti { fn pref_align_of() -> uint; fn min_align_of() -> uint; } diff --git a/src/test/run-pass/intrinsic-atomics.rs b/src/test/run-pass/intrinsic-atomics.rs index d2418abcb77..5170e5b407b 100644 --- a/src/test/run-pass/intrinsic-atomics.rs +++ b/src/test/run-pass/intrinsic-atomics.rs @@ -1,5 +1,5 @@ #[abi = "rust-intrinsic"] -native mod rusti { +extern mod rusti { fn atomic_xchng(&dst: int, src: int) -> int; fn atomic_xchng_acq(&dst: int, src: int) -> int; fn atomic_xchng_rel(&dst: int, src: int) -> int; diff --git a/src/test/run-pass/intrinsic-frame-address.rs b/src/test/run-pass/intrinsic-frame-address.rs index 6af3c7555d0..31ea745d162 100644 --- a/src/test/run-pass/intrinsic-frame-address.rs +++ b/src/test/run-pass/intrinsic-frame-address.rs @@ -1,5 +1,5 @@ #[abi = "rust-intrinsic"] -native mod rusti { +extern mod rusti { fn frame_address(f: fn(*u8)); } diff --git a/src/test/run-pass/intrinsic-move-val.rs b/src/test/run-pass/intrinsic-move-val.rs index e47aa36a777..80dcf2a4199 100644 --- a/src/test/run-pass/intrinsic-move-val.rs +++ b/src/test/run-pass/intrinsic-move-val.rs @@ -1,5 +1,5 @@ #[abi = "rust-intrinsic"] -native mod rusti { +extern mod rusti { fn move_val_init(&dst: T, -src: T); fn move_val(&dst: T, -src: T); } diff --git a/src/test/run-pass/issue-1251.rs b/src/test/run-pass/issue-1251.rs index 69e54f4a95d..0a73daa234d 100644 --- a/src/test/run-pass/issue-1251.rs +++ b/src/test/run-pass/issue-1251.rs @@ -1,6 +1,6 @@ #[link(name = "unsupervise")]; -native mod rustrt { +extern mod rustrt { fn unsupervise(); } diff --git a/src/test/run-pass/issue-1866.rs b/src/test/run-pass/issue-1866.rs index 8035ad5f038..c7219fbc2d9 100644 --- a/src/test/run-pass/issue-1866.rs +++ b/src/test/run-pass/issue-1866.rs @@ -1,14 +1,14 @@ // xfail-test mod a { type rust_task = uint; - native mod rustrt { + extern mod rustrt { fn rust_task_is_unwinding(rt: *rust_task) -> bool; } } mod b { type rust_task = bool; - native mod rustrt { + extern mod rustrt { fn rust_task_is_unwinding(rt: *rust_task) -> bool; } } diff --git a/src/test/run-pass/issue-2214.rs b/src/test/run-pass/issue-2214.rs index 6795375e869..7847ef3c8e0 100644 --- a/src/test/run-pass/issue-2214.rs +++ b/src/test/run-pass/issue-2214.rs @@ -7,7 +7,7 @@ fn lgamma(n: c_double, value: &mut int) -> c_double { #[link_name = "m"] #[abi = "cdecl"] -native mod m { +extern mod m { #[cfg(unix)] #[link_name="lgamma_r"] fn lgamma(n: c_double, sign: &mut c_int) -> c_double; diff --git a/src/test/run-pass/issue-506.rs b/src/test/run-pass/issue-506.rs index 458a0b12698..1c73de5b0c8 100644 --- a/src/test/run-pass/issue-506.rs +++ b/src/test/run-pass/issue-506.rs @@ -6,7 +6,7 @@ use std; import task; #[abi = "cdecl"] -native mod rustrt { +extern mod rustrt { fn rust_task_allow_kill(); } diff --git a/src/test/run-pass/item-attributes.rs b/src/test/run-pass/item-attributes.rs index 2f10b0ef1ff..bcb70aba648 100644 --- a/src/test/run-pass/item-attributes.rs +++ b/src/test/run-pass/item-attributes.rs @@ -30,7 +30,7 @@ mod test_single_attr_outer { #[attr = "val"] #[abi = "cdecl"] - native mod rustrt { } + extern mod rustrt { } } mod test_multi_attr_outer { @@ -50,7 +50,7 @@ mod test_multi_attr_outer { #[attr1 = "val"] #[attr2 = "val"] #[abi = "cdecl"] - native mod rustrt { } + extern mod rustrt { } #[attr1 = "val"] #[attr2 = "val"] @@ -74,7 +74,7 @@ mod test_stmt_single_attr_outer { #[attr = "val"] #[abi = "cdecl"] - native mod rustrt { + extern mod rustrt { } */ } @@ -101,7 +101,7 @@ mod test_stmt_multi_attr_outer { #[attr1 = "val"] #[attr2 = "val"] #[abi = "cdecl"] - native mod rustrt { + extern mod rustrt { } */ } @@ -159,7 +159,7 @@ mod test_other_forms { mod test_foreign_items { #[abi = "cdecl"] - native mod rustrt { + extern mod rustrt { #[attr]; #[attr] diff --git a/src/test/run-pass/morestack6.rs b/src/test/run-pass/morestack6.rs index eb0f71e67ed..69a904e00cd 100644 --- a/src/test/run-pass/morestack6.rs +++ b/src/test/run-pass/morestack6.rs @@ -5,7 +5,7 @@ use std; import task; import std::rand; -native mod rustrt { +extern mod rustrt { fn debug_get_stk_seg() -> *u8; fn unsupervise(); diff --git a/src/test/run-pass/native-src/native.rs b/src/test/run-pass/native-src/native.rs deleted file mode 100644 index 164c55d0e9f..00000000000 --- a/src/test/run-pass/native-src/native.rs +++ /dev/null @@ -1,9 +0,0 @@ - - - -// -*- rust -*- -fn main() { - libc.puts(rustrt.str_buf("hello, native world 1")); - libc.puts(rustrt.str_buf("hello, native world 2")); - libc.puts(rustrt.str_buf("hello, native world 3")); -} diff --git a/src/test/run-pass/newtype.rs b/src/test/run-pass/newtype.rs index 32fde0f4edc..f6a9be124f3 100644 --- a/src/test/run-pass/newtype.rs +++ b/src/test/run-pass/newtype.rs @@ -1,4 +1,4 @@ -enum mytype = {compute: native fn(mytype) -> int, val: int}; +enum mytype = {compute: extern fn(mytype) -> int, val: int}; fn compute(i: mytype) -> int { ret i.val + 20; } diff --git a/src/test/run-pass/nil-decl-in-native.rs b/src/test/run-pass/nil-decl-in-foreign.rs similarity index 77% rename from src/test/run-pass/nil-decl-in-native.rs rename to src/test/run-pass/nil-decl-in-foreign.rs index 126a1a371be..b35b81b11e2 100644 --- a/src/test/run-pass/nil-decl-in-native.rs +++ b/src/test/run-pass/nil-decl-in-foreign.rs @@ -1,6 +1,6 @@ // Issue #901 #[nolink] -native mod libc { +extern mod libc { fn printf(x: ()); } fn main() { } \ No newline at end of file diff --git a/src/test/run-pass/rec-align-u32.rs b/src/test/run-pass/rec-align-u32.rs index 89f3305bf79..3f109d78e52 100644 --- a/src/test/run-pass/rec-align-u32.rs +++ b/src/test/run-pass/rec-align-u32.rs @@ -2,7 +2,7 @@ // Issue #2303 #[abi = "rust-intrinsic"] -native mod rusti { +extern mod rusti { fn pref_align_of() -> uint; fn min_align_of() -> uint; } diff --git a/src/test/run-pass/rec-align-u64.rs b/src/test/run-pass/rec-align-u64.rs index 39646bb04e0..2476cf7d818 100644 --- a/src/test/run-pass/rec-align-u64.rs +++ b/src/test/run-pass/rec-align-u64.rs @@ -2,7 +2,7 @@ // Issue #2303 #[abi = "rust-intrinsic"] -native mod rusti { +extern mod rusti { fn pref_align_of() -> uint; fn min_align_of() -> uint; } diff --git a/src/test/run-pass/resource-generic.rs b/src/test/run-pass/resource-generic.rs index 2cc23c1daad..21fe5461789 100644 --- a/src/test/run-pass/resource-generic.rs +++ b/src/test/run-pass/resource-generic.rs @@ -1,6 +1,6 @@ class finish { - let arg: {val: T, fin: native fn(T)}; - new(arg: {val: T, fin: native fn(T)}) { + let arg: {val: T, fin: extern fn(T)}; + new(arg: {val: T, fin: extern fn(T)}) { self.arg = arg; } drop { self.arg.fin(self.arg.val); } diff --git a/src/test/run-pass/rt-sched-1.rs b/src/test/run-pass/rt-sched-1.rs index 553ee0a88c1..a30b1964bda 100644 --- a/src/test/run-pass/rt-sched-1.rs +++ b/src/test/run-pass/rt-sched-1.rs @@ -8,7 +8,7 @@ type task_id = *libc::c_void; type task = *libc::c_void; type closure = *libc::c_void; -native mod rustrt { +extern mod rustrt { fn rust_new_sched(num_threads: libc::uintptr_t) -> sched_id; fn rust_get_sched_id() -> sched_id; fn rust_new_task_in_sched(id: sched_id) -> task_id; diff --git a/src/test/run-pass/sendfn-generic-fn.rs b/src/test/run-pass/sendfn-generic-fn.rs index ba56b12d8f7..bc8ecd7047a 100644 --- a/src/test/run-pass/sendfn-generic-fn.rs +++ b/src/test/run-pass/sendfn-generic-fn.rs @@ -23,7 +23,7 @@ fn test05_start(&&f: fn~(&&float, &&str) -> pair) { assert q.b == "Ho"; } -fn spawn(f: native fn(fn~(A,B)->pair)) { +fn spawn(f: extern fn(fn~(A,B)->pair)) { let arg = fn~(a: A, b: B) -> pair { ret make_generic_record(a, b); }; diff --git a/src/test/run-pass/struct-return.rs b/src/test/run-pass/struct-return.rs index 63385b8e4d5..34108f30f2d 100644 --- a/src/test/run-pass/struct-return.rs +++ b/src/test/run-pass/struct-return.rs @@ -2,7 +2,7 @@ type quad = { a: u64, b: u64, c: u64, d: u64 }; type floats = { a: f64, b: u8, c: f64 }; #[nolink] -native mod rustrt { +extern mod rustrt { fn debug_abi_1(++q: quad) -> quad; fn debug_abi_2(++f: floats) -> floats; } diff --git a/src/test/run-pass/tail-cps.rs b/src/test/run-pass/tail-cps.rs index a5cb9c6f5fa..c2d38c67aaf 100644 --- a/src/test/run-pass/tail-cps.rs +++ b/src/test/run-pass/tail-cps.rs @@ -6,13 +6,13 @@ fn checktrue(rs: bool) -> bool { assert (rs); ret true; } fn main() { let k = checktrue; evenk(42, k); oddk(45, k); } -fn evenk(n: int, k: native fn(bool) -> bool) -> bool { +fn evenk(n: int, k: extern fn(bool) -> bool) -> bool { #debug("evenk"); log(debug, n); if n == 0 { ret k(true); } else { ret oddk(n - 1, k); } } -fn oddk(n: int, k: native fn(bool) -> bool) -> bool { +fn oddk(n: int, k: extern fn(bool) -> bool) -> bool { #debug("oddk"); log(debug, n); if n == 0 { ret k(false); } else { ret evenk(n - 1, k); } diff --git a/src/test/run-pass/type-param.rs b/src/test/run-pass/type-param.rs index 4d5f4a2fd17..a2afde8d73f 100644 --- a/src/test/run-pass/type-param.rs +++ b/src/test/run-pass/type-param.rs @@ -1,5 +1,5 @@ -type lteq = native fn(T) -> bool; +type lteq = extern fn(T) -> bool; fn main(args: ~[str]) { } diff --git a/src/test/run-pass/type-params-in-for-each.rs b/src/test/run-pass/type-params-in-for-each.rs index 5400faa1df5..bbaafa6770d 100644 --- a/src/test/run-pass/type-params-in-for-each.rs +++ b/src/test/run-pass/type-params-in-for-each.rs @@ -5,7 +5,7 @@ fn range(lo: uint, hi: uint, it: fn(uint)) { while lo_ < hi { it(lo_); lo_ += 1u; } } -fn create_index(index: ~[{a: T, b: uint}], hash_fn: native fn(T) -> uint) { +fn create_index(index: ~[{a: T, b: uint}], hash_fn: extern fn(T) -> uint) { range(0u, 256u, |_i| { let bucket: ~[T] = ~[]; } ) } diff --git a/src/test/run-pass/warn-ctypes-inhibit.rs b/src/test/run-pass/warn-ctypes-inhibit.rs index d0df4228779..1ce376f07a4 100644 --- a/src/test/run-pass/warn-ctypes-inhibit.rs +++ b/src/test/run-pass/warn-ctypes-inhibit.rs @@ -3,7 +3,7 @@ #[warn(no_ctypes)]; #[nolink] -native mod libc { +extern mod libc { fn malloc(size: int) -> *u8; } diff --git a/src/test/run-pass/x86stdcall.rs b/src/test/run-pass/x86stdcall.rs index b9d9b84a526..31850801034 100644 --- a/src/test/run-pass/x86stdcall.rs +++ b/src/test/run-pass/x86stdcall.rs @@ -2,7 +2,7 @@ // xfail-test #[cfg(target_os = "win32")] -native "stdcall" mod kernel32 { +extern "stdcall" mod kernel32 { fn SetLastError(err: uint); fn GetLastError() -> uint; } diff --git a/src/test/run-pass/x86stdcall2.rs b/src/test/run-pass/x86stdcall2.rs index e58656a73a4..423bafae452 100644 --- a/src/test/run-pass/x86stdcall2.rs +++ b/src/test/run-pass/x86stdcall2.rs @@ -6,7 +6,7 @@ type BOOL = u8; #[cfg(target_os = "win32")] #[abi = "stdcall"] -native mod kernel32 { +extern mod kernel32 { fn GetProcessHeap() -> HANDLE; fn HeapAlloc(hHeap: HANDLE, dwFlags: DWORD, dwBytes: SIZE_T) -> LPVOID; fn HeapFree(hHeap: HANDLE, dwFlags: DWORD, lpMem: LPVOID) -> BOOL;