]> git.lizzy.rs Git - rust.git/commitdiff
Switch 'native' to 'extern' (or 'foreign' in some descriptions)
authorGraydon Hoare <graydon@mozilla.com>
Tue, 3 Jul 2012 23:11:00 +0000 (16:11 -0700)
committerGraydon Hoare <graydon@mozilla.com>
Tue, 3 Jul 2012 23:11:00 +0000 (16:11 -0700)
141 files changed:
src/fuzzer/fuzzer.rs
src/libcore/arc.rs
src/libcore/cmath.rs
src/libcore/comm.rs
src/libcore/io.rs
src/libcore/libc.rs
src/libcore/logging.rs
src/libcore/os.rs
src/libcore/priv.rs
src/libcore/ptr.rs
src/libcore/rand.rs
src/libcore/run.rs
src/libcore/stackwalk.rs
src/libcore/str.rs
src/libcore/sys.rs
src/libcore/task.rs
src/libcore/unsafe.rs
src/libcore/vec.rs
src/libstd/c_vec.rs
src/libstd/dbg.rs
src/libstd/net_tcp.rs
src/libstd/test.rs
src/libstd/time.rs
src/libstd/unicode.rs
src/libstd/uv_global_loop.rs
src/libstd/uv_ll.rs
src/libsyntax/ast.rs
src/libsyntax/ast_map.rs
src/rustc/back/link.rs
src/rustc/back/rpath.rs
src/rustc/front/intrinsic.rs
src/rustc/lib/llvm.rs
src/rustc/metadata/creader.rs
src/rustc/metadata/decoder.rs
src/rustc/middle/lint.rs
src/rustc/middle/resolve.rs
src/rustc/middle/trans/base.rs
src/rustc/middle/trans/foreign.rs
src/rustc/middle/typeck.rs
src/rustc/middle/typeck/check.rs
src/rustc/middle/typeck/collect.rs
src/rustdoc/attr_pass.rs
src/rustdoc/extract.rs
src/rustdoc/markdown_index_pass.rs
src/rustdoc/markdown_pass.rs
src/rustdoc/page_pass.rs
src/rustdoc/path_pass.rs
src/rustdoc/reexport_pass.rs
src/rustdoc/sort_item_type_pass.rs
src/rustdoc/tystr_pass.rs
src/test/auxiliary/foreign_lib.rs
src/test/auxiliary/test_comm.rs
src/test/bench/shootout-nbody.rs
src/test/compile-fail/bad-main.rs
src/test/compile-fail/bad-var-env-capture-in-block-arg.rs
src/test/compile-fail/block-coerce-no-2.rs
src/test/compile-fail/block-coerce-no.rs
src/test/compile-fail/crust-no-call.rs
src/test/compile-fail/empty-linkname.rs
src/test/compile-fail/empty-linkname2.rs
src/test/compile-fail/foreign-unsafe-fn-called.rs [new file with mode: 0644]
src/test/compile-fail/foreign-unsafe-fn.rs [new file with mode: 0644]
src/test/compile-fail/native-unsafe-fn-called.rs [deleted file]
src/test/compile-fail/native-unsafe-fn.rs [deleted file]
src/test/compile-fail/nolink-with-link-args.rs
src/test/compile-fail/redundant-link-args.rs
src/test/compile-fail/unsupported-cast.rs
src/test/compile-fail/warn-ctypes-err-attr.rs
src/test/compile-fail/warn-ctypes.rs
src/test/compile-fail/warn-foreign-int-types.rs [new file with mode: 0644]
src/test/compile-fail/warn-native-int-types.rs [deleted file]
src/test/run-fail/crust-fail.rs
src/test/run-fail/morestack2.rs
src/test/run-pass/binops.rs
src/test/run-pass/c-stack-as-value.rs
src/test/run-pass/c-stack-returning-int64.rs
src/test/run-pass/class-dtor.rs
src/test/run-pass/conditional-compile.rs
src/test/run-pass/crust-call-deep.rs
src/test/run-pass/crust-call-deep2.rs
src/test/run-pass/crust-call-scrub.rs
src/test/run-pass/crust-call.rs
src/test/run-pass/crust-stress.rs
src/test/run-pass/crust-yield.rs
src/test/run-pass/expr-block-fn.rs
src/test/run-pass/fixed-point-bind-box.rs
src/test/run-pass/fixed-point-bind-unique.rs
src/test/run-pass/fn-bare-assign.rs
src/test/run-pass/fn-bare-spawn.rs
src/test/run-pass/fn-lval.rs
src/test/run-pass/foreign-dupe.rs [new file with mode: 0644]
src/test/run-pass/foreign-fn-linkname.rs [new file with mode: 0644]
src/test/run-pass/foreign-lib-path.rs [new file with mode: 0644]
src/test/run-pass/foreign-mod-src/inner.rs [new file with mode: 0644]
src/test/run-pass/foreign-mod.rc [new file with mode: 0644]
src/test/run-pass/foreign-no-abi.rs [new file with mode: 0644]
src/test/run-pass/foreign-src/foreign.rs [new file with mode: 0644]
src/test/run-pass/foreign-struct.rs [new file with mode: 0644]
src/test/run-pass/foreign.rc [new file with mode: 0644]
src/test/run-pass/foreign2.rs [new file with mode: 0644]
src/test/run-pass/fun-indirect-call.rs
src/test/run-pass/generic-temporary.rs
src/test/run-pass/hashmap-memory.rs
src/test/run-pass/import-from-foreign.rs [new file with mode: 0644]
src/test/run-pass/import-from-native.rs [deleted file]
src/test/run-pass/import-glob-1.rs
src/test/run-pass/intrinsic-alignment.rs
src/test/run-pass/intrinsic-atomics.rs
src/test/run-pass/intrinsic-frame-address.rs
src/test/run-pass/intrinsic-move-val.rs
src/test/run-pass/issue-1251.rs
src/test/run-pass/issue-1866.rs
src/test/run-pass/issue-2214.rs
src/test/run-pass/issue-506.rs
src/test/run-pass/item-attributes.rs
src/test/run-pass/morestack6.rs
src/test/run-pass/native-dupe.rs [deleted file]
src/test/run-pass/native-fn-linkname.rs [deleted file]
src/test/run-pass/native-lib-path.rs [deleted file]
src/test/run-pass/native-mod-src/inner.rs [deleted file]
src/test/run-pass/native-mod.rc [deleted file]
src/test/run-pass/native-no-abi.rs [deleted file]
src/test/run-pass/native-src/native.rs [deleted file]
src/test/run-pass/native-struct.rs [deleted file]
src/test/run-pass/native.rc [deleted file]
src/test/run-pass/native2.rs [deleted file]
src/test/run-pass/newtype.rs
src/test/run-pass/nil-decl-in-foreign.rs [new file with mode: 0644]
src/test/run-pass/nil-decl-in-native.rs [deleted file]
src/test/run-pass/rec-align-u32.rs
src/test/run-pass/rec-align-u64.rs
src/test/run-pass/resource-generic.rs
src/test/run-pass/rt-sched-1.rs
src/test/run-pass/sendfn-generic-fn.rs
src/test/run-pass/struct-return.rs
src/test/run-pass/tail-cps.rs
src/test/run-pass/type-param.rs
src/test/run-pass/type-params-in-for-each.rs
src/test/run-pass/warn-ctypes-inhibit.rs
src/test/run-pass/x86stdcall.rs
src/test/run-pass/x86stdcall2.rs

index d052e0739ded319583e947b88d1ebfcfa0761d86..e6a7a9fcfe6f8113b9c83db6478cb4a197309ae6 100644 (file)
@@ -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?
 
index a498749de168aa53f444c0e078d42a5b6373d12b..6b576afe50c1b324902430589d511753ebf30361 100644 (file)
@@ -9,7 +9,7 @@
 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;
index fbb434d8e4b5cd83e121d6f1fd9a5f0e160aad19..de611ab2c0a49bacdaa3c6bcad18e23df1318c4e 100644 (file)
@@ -17,7 +17,7 @@
 
 #[link_name = "m"]
 #[abi = "cdecl"]
-native mod c_double {
+extern mod c_double {
 
     // Alpabetically sorted by link_name
 
@@ -95,7 +95,7 @@
 
 #[link_name = "m"]
 #[abi = "cdecl"]
-native mod c_float {
+extern mod c_float {
 
     // Alpabetically sorted by link_name
 
index 75a21ad53587cc2c82fcb7ac44af1fa183723ea3..baf4e82ecd5150024fea95cce486d1b58c1ceef0 100644 (file)
@@ -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 @@ fn rust_port_select(dptr: **rust_port, ports: **rust_port,
 }
 
 #[abi = "rust-intrinsic"]
-native mod rusti {
+extern mod rusti {
     fn init<T>() -> T;
 }
 
index 8527f58ca6caa5950686842db88ee9e045587283..08da519a1bcb68310b1eeac6b14f1c26c4416d44 100644 (file)
@@ -14,7 +14,7 @@
 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 @@ fn write(v: &[const u8]) {
         }
     }
     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 }
index c2679c6956e95d817c1d1986d53fd9e958716071..4ccc9f2010d363c0c07d2d33257a8702aa135be0 100644 (file)
@@ -731,7 +731,7 @@ mod c95 {
 
         #[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 c95 {
 
         #[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 @@ fn fwrite(ptr: *c_void, size: size_t,
 
         #[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 @@ fn fwrite(ptr: *c_void, size: size_t,
 
         #[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 posix88 {
 
         #[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 posix88 {
 
         #[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 posix88 {
 
         #[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 posix88 {
 
         #[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 posix88 {
 
         #[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 posix88 {
 
         #[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 posix88 {
 
         #[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 posix88 {
 
         #[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 posix88 {
 
         #[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 posix01 {
 
         #[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 @@ fn setenv(name: *c_char, val: *c_char,
 
         #[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 @@ fn waitpid(pid: pid_t, status: *mut c_int,
     #[cfg(target_os = "win32")]
     mod posix01 {
         #[nolink]
-        native mod unistd { }
+        extern mod unistd { }
     }
 
 
@@ -1092,7 +1092,7 @@ mod posix01 {
     #[cfg(target_os = "freebsd")]
     mod posix08 {
         #[nolink]
-        native mod unistd { }
+        extern mod unistd { }
     }
 
 
@@ -1100,7 +1100,7 @@ mod posix08 {
     #[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 bsd44 {
     #[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 extra {
         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 @@ fn CopyFileW(lpExistingFileName: LPCWSTR,
 
         #[abi = "cdecl"]
         #[nolink]
-        native mod msvcrt {
+        extern mod msvcrt {
             #[link_name = "_commit"]
             fn commit(fd: c_int) -> c_int;
         }
index 48e3fcc2ff24384cb6b479f5958775a1b1407cce..261a18f6f7df3f251a759b2b73ab40bfb845b638 100644 (file)
@@ -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();
 }
index b945a998084053409e70f457a58f425921011283..ec553ad5e2f1afc28d74b836eb0982746fffdcf0 100644 (file)
@@ -39,7 +39,7 @@
 // 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;
     }
 
index 8d8ce9a9d72f27715e85a274671573370e816b5f..447c9352dda801bb923022f5e819a6faba8038bd 100644 (file)
@@ -6,7 +6,7 @@
 
 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;
index b3eaa3bd16dca259f06942e28631b763a64b439b..b6913f9479e3c8aebcf492b0a42536b93005cb42 100644 (file)
@@ -19,7 +19,7 @@
 
 #[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 @@
 }
 
 #[abi = "rust-intrinsic"]
-native mod rusti {
+extern mod rusti {
     fn addr_of<T>(val: T) -> *T;
 }
 
index 4724c00941c480b51316f142aede7c9c35ec6d90..e004aa32dc71230a47ab56282a68f150ddb120bd 100644 (file)
@@ -6,7 +6,7 @@
 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;
index 7bb3b56fa1b7961ad2d7d3417cb8896574087de3..8481793a8ff645d4ec9fcd258283fc4f4ff9fcfc 100644 (file)
@@ -10,7 +10,7 @@
 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)
index 4af007b14dd1a38867165daba8867f2b775d89b8..8964067da0b80e6f71e9f4ad0e4a3f95c8f05453 100644 (file)
@@ -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));
 }
index 3618772027e5524c74ebd0baf453038503a6cc94..b87a575fdef2497edcfabe65db21603611c56255 100644 (file)
    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 @@ fn is_alphanumeric(s: str/&) -> bool {
 #[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 @@ fn is_alphanumeric(s: str/&) -> bool {
 #[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 @@ fn is_alphanumeric(s: str/&) -> bool {
 #[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
index 28ef48240ee07de61a9f966139e6082d5a2ad6af..992083c484b02da178623a5a8a5d54e5a25716d9 100644 (file)
@@ -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 @@ enum type_desc = {
 }
 
 #[abi = "rust-intrinsic"]
-native mod rusti {
+extern mod rusti {
     fn get_tydesc<T>() -> *();
     fn size_of<T>() -> uint;
     fn pref_align_of<T>() -> uint;
index f452e611018958c3c003535dc05540b74d198650..f97a39734b825f94d5c2c4620bfa2e015f050226 100644 (file)
@@ -609,7 +609,7 @@ fn new_task_in_new_sched(opts: sched_opts) -> *rust_task {
 // 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);
index 98bfa5bbfc4a839609f807a1c0737a52f9c67560..a4e4c4fe1667265ba73ae39726bc021a30695285 100644 (file)
@@ -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;
 }
index 66b7ddc6daf016353892cd92a62e844984b897a3..81039ec552174e8a186622baca223d74dfc69b1e 100644 (file)
@@ -85,7 +85,7 @@
 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 @@ fn vec_from_buf_shared(++t: *sys::type_desc,
 }
 
 #[abi = "rust-intrinsic"]
-native mod rusti {
+extern mod rusti {
     fn move_val_init<T>(&dst: T, -src: T);
 }
 
@@ -1125,8 +1125,8 @@ fn iter2<U, T>(v1: &[U], v2: &[T], f: fn(U, T)) {
 #[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))
index 02ed63981b960c3bf393d8165de673b382f573a1..258bc432da141a061a3c6a50bf427487af819c0f 100644 (file)
@@ -32,7 +32,7 @@
 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 @@ enum 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.
 
 # 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.
index 39746eae55e0d8a7ee16529baeeba22baed383b2..be0330e543ac6b46ccd0b52a2542fac97522eb51 100644 (file)
@@ -11,7 +11,7 @@
 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: *());
index cfae6a3ba13ba9757a7667788f660b32483fe7a3..3c9beb241980ac504b27cbb6c8b1b0783259ef0e 100644 (file)
@@ -28,7 +28,7 @@
 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;
index 42ff9f6366a0cf50f41313d4c6c2335f2fd823bb..bbf895840d86df166346fb8ae74b1f2a052762e8 100644 (file)
@@ -22,7 +22,7 @@
 export run_tests_console;
 
 #[abi = "cdecl"]
-native mod rustrt {
+extern mod rustrt {
     fn sched_threads() -> libc::size_t;
 }
 
index fa1597925bd25e52a7996d444bb974d12a7e8207..ba53bdbf01417fbb2989cfb85331a723d051f04d 100644 (file)
@@ -17,7 +17,7 @@
     strptime;
 
 #[abi = "cdecl"]
-native mod rustrt {
+extern mod rustrt {
     fn get_time(&sec: i64, &nsec: i32);
     fn precise_time_ns(&ns: u64);
 
index c5bfd302305be6e0282aa187ba0ed77ea009ce60..df2c28be7c943e18a2e8c598c88e50cae05ec363 100644 (file)
@@ -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;
index aab8040c0a49796d00d34383bfefc1d15f3a5b77..611100f61f774e4dfebe5f4199e018e676ff7b61 100644 (file)
@@ -12,7 +12,7 @@
 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;
 }
 
index ff3ed3b9a6bdabc53ac0612259633d7392e779a1..d272299829905c741941913b5a7366bc6a6c50a1 100644 (file)
@@ -556,7 +556,7 @@ fn gen_stub_uv_getaddrinfo_t() -> uv_getaddrinfo_t {
 }
 
 #[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 @@ fn test_uv_ll_tcp_server_and_request() unsafe {
     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 @@ fn test_uv_ll_struct_size_uv_connect_t() {
         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 @@ fn test_uv_ll_struct_size_uv_buf_t() {
         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 @@ fn test_uv_ll_struct_size_uv_write_t() {
         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 @@ fn test_uv_ll_struct_size_sockaddr_in() {
         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 @@ fn test_uv_ll_struct_size_sockaddr_in6() {
         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 @@ fn test_uv_ll_struct_size_addr_in() {
         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 @@ fn test_uv_ll_struct_size_uv_async_t() {
         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 @@ fn test_uv_ll_struct_size_uv_timer_t() {
         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 @@ fn test_uv_ll_struct_size_uv_getaddrinfo_t() {
         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 @@ fn test_uv_ll_struct_size_addrinfo() {
         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;
index 90dbc1a82f2e6c5a591301ba660a3125dfae5ed4..4dff52615468935942fd097948214cad4871a3f0 100644 (file)
@@ -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@
index 3b4fe5f91ee545daab6499928826bb44ee0c1476..bd910058971e517c3ffe765bffcb3c64c75bacd8 100644 (file)
@@ -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)) {
index 5603300e0405b7878144c6738a162c38763a09a8..33f9f376953c91fa0e55045c36358f8ad0c61cfe 100644 (file)
@@ -609,7 +609,7 @@ fn rmext(filename: str) -> str {
     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 rmext(filename: str) -> str {
     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 rmext(filename: str) -> str {
     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, " "));
index 55e4ba8d0823c094c9d94c8552d021d9c0413488..2625a244bebfe8d9620a0d96b48887633980c491 100644 (file)
@@ -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));
 
index 6496d8052d408988c8ffe5f9e867b471cc8fdbfa..cfd367bb889cda19a2bdc72cf484f1df03937a91 100644 (file)
@@ -121,7 +121,7 @@ fn visit_leave_fn(purity: uint, proto: uint,
     }
 
     #[abi = "rust-intrinsic"]
-    native mod rusti {
+    extern mod rusti {
         fn visit_ty<T>(&&tv: ty_visitor);
     }
 }
index 60bb9c57f1cf7721555bc4863dceed9c6df3120d..1df423cdbb226efefd187bebf7b5a02b1c1dd381 100644 (file)
@@ -191,7 +191,7 @@ enum 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;
index 8f920e6bbbe6525de1f883d86d36011d45837f81..bb001427121017b5f2843502d844bfc387539a66 100644 (file)
@@ -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 @@
 
 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,
index 1f8aae87b7c8a47a26d51f2bbc0797bf56c7c31d..4d92857375f312c2678a16104fe00c3e78eefe54 100644 (file)
@@ -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"; }
index b9d716ad2297c5d126c324c6252b96185e0d0990..3c8083e7f76c8eced8e146924e184d910cb2cada 100644 (file)
@@ -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_foreign_fn(cx: ty::ctxt, fn_id: ast::node_id,
                     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");
                   }
                   _ { }
index 143901a9eadaf633647f69ecc8a5d1f5017f51e1..330a5dac3833f138b32a81e06167cf80603b1f40 100644 (file)
@@ -106,7 +106,7 @@ enum mod_index_entry {
     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) {
index a37077863637aadb044d28fdf64a1f0339b572c1..457ffd8e401222935672cad52a4f5061b933fb8b 100644 (file)
@@ -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
index 240d739b722575af6ba924e3b617c70b6d52773c..70464930fe6feb68515698096daeca1114b31919 100644 (file)
@@ -19,7 +19,7 @@
 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 build_rust_fn(ccx: @crate_ctxt, path: ast_map::path,
     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 build_ret(_bcx: block, _tys: @c_stack_tys,
     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 build_args(bcx: block, tys: @c_stack_tys,
 
         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 build_ret(bcx: block, tys: @c_stack_tys,
     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 {
index 500c469bdaca379e9a86b1340328421bd2246fc8..92fbac2088598a2f32eddf0d3658dc41350c36c4 100644 (file)
@@ -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)));
          }
       }
index ef0815927e4f3670f1c8ab1151c48590fa87b762..31bd88e85617bd894a3150447cb28528a3940b8b 100644 (file)
@@ -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_call_or_bind(
                 // 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));
               }
             };
index a713ae675484110e2d63c03154760f924296ebbb..f64cfed7c81be4f85473ec06ddfe92e1cd5e4856 100644 (file)
@@ -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 {
index 0a00a5ef58c428c4949196145e28942c7e9d1fa0..d2afba56f28db9338773c62b61c600e7e2478ce1 100644 (file)
@@ -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");
 }
 
index 66585d5683eda20c8eba7872f1e18fd3b2116e64..0d4182a6ee802192e0a5c8790eb2f91d9c2888b8 100644 (file)
@@ -291,13 +291,13 @@ fn extract_mods() {
 
     #[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";
     }
 
index 25691cb79d910d2a8368e12fe91b054106274cc4..83098ecd0452747571c8980e8520d0690d9189eb 100644 (file)
@@ -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",
index a616897f3b24d05071cbbef23525238d000d869e..cb3da77362dff50b55ff5954202aa5d91fcff26b 100644 (file)
@@ -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`");
 }
 
index 80af8f2553fb63f882196db4a5409267cfaae1e4..a360686e358624b8ecad5fdf6ff77c2df7c199e3 100644 (file)
@@ -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());
 }
 
index 99be48c03620bd4ac3569694ee66d308a2364cf1..07029029c6ed13dd2fd1fb50cc30380365b3af8a 100644 (file)
@@ -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);
index a998faeac31372884370dd25697befff5666245a..3c28501aa984477211c6176a21d8e4561115efac 100644 (file)
@@ -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";
index 7536da57150d16bacf497aa3e50e9c47be59f89d..de74f2f535ed20329fe1658335e0f4d413da3eb7 100644 (file)
@@ -25,7 +25,7 @@ fn score(item: doc::itemtag) -> int {
 fn test() {
     let source =
         "mod imod { } \
-         native mod inmod { } \
+         extern mod inmod { } \
          const iconst: int = 0; \
          fn ifn() { } \
          enum ienum { ivar } \
index 69b86bff19b3a4a0ce8da7cb93339f7429b71b92..7de5f48db32b483608e5394edbb399af777db524 100644 (file)
@@ -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");
 }
 
index 16eb4f9589fc0694b0c06092148f03306a64173c..ff4bb5266eca2ce98cbc90c7f8cb0f290b175b57 100644 (file)
@@ -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
index 50553fbdacf9c640c66d03aea14f6037211aaede..62389aece6adc5c75000dee6412deb6c5ac5bed1 100644 (file)
@@ -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 @@ fn port_recv(dptr: *uint, po: *rust_port,
 }
 
 #[abi = "rust-intrinsic"]
-native mod rusti {
+extern mod rusti {
     fn init<T>() -> T;
 }
 
index aa9d411f2b63c4cd5e7bef3eb5606bbe2c356236..56b01325b245f1343c93ed889cf754a93808dcc7 100644 (file)
@@ -9,7 +9,7 @@
 // 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;
 }
 
index e616a05eabe99fbeab463c85ac9d2317bb9babd1..79f21dc62c3163136b5e47806834a043c0e608b3 100644 (file)
@@ -1,3 +1,3 @@
-// error-pattern:expecting `native fn(~[str])
+// error-pattern:expecting `extern fn(~[str])
 
 fn main(x: int) { }
index 898c164e9dc673124eecc4dc1c6499ca2ab749bc..e7786129472b5e78bc134b5595f488ccc8bf9026 100644 (file)
@@ -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
     });
index 780a91b664cea813540b34d8ffb9737c495798e2..9726dc9b4c98d7189ab993af330a9d1deb6d088a 100644 (file)
@@ -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);
index e789775fe7deeafaeb10b6b6624f1d4c78074816..dd8f77ce20e94933b4c1360ae1baafe28ea72784 100644 (file)
@@ -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()`
 }
index d6a3fffb754d39d532602d5d26100fb00b007e7a..61d8c25459afeccffe0a023a9f7f5d6fa8f135d9 100644 (file)
@@ -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() {
 }
 
index 1e04913884bf084b66df5606a67e7d3350856284..0b6cd08d6bce14a067db12c10750c2a3bc8c3519 100644 (file)
@@ -1,5 +1,5 @@
 // error-pattern:empty #[link_name] not allowed; use #[nolink].
 
 #[link_name = ""]
-native mod foo {
+extern mod foo {
 }
index 567208f7897e6e4b80bb797bd021f55ec48b3248..2c87c7308e2152423f43527b4b86e1ff34493a3e 100644 (file)
@@ -3,5 +3,5 @@
 
 #[link_name = ""]
 #[nolink]
-native mod foo {
+extern mod foo {
 }
diff --git a/src/test/compile-fail/foreign-unsafe-fn-called.rs b/src/test/compile-fail/foreign-unsafe-fn-called.rs
new file mode 100644 (file)
index 0000000..c5c80d3
--- /dev/null
@@ -0,0 +1,12 @@
+// -*- rust -*-
+
+#[abi = "cdecl"]
+extern mod test {
+    unsafe fn free();
+}
+
+fn main() {
+    test::free();
+    //~^ ERROR access to unsafe function requires unsafe function or block
+}
+
diff --git a/src/test/compile-fail/foreign-unsafe-fn.rs b/src/test/compile-fail/foreign-unsafe-fn.rs
new file mode 100644 (file)
index 0000000..f0619e1
--- /dev/null
@@ -0,0 +1,13 @@
+// -*- rust -*-
+
+#[abi = "cdecl"]
+extern mod test {
+    unsafe fn free();
+}
+
+fn main() {
+    let x = test::free;
+    //~^ ERROR access to unsafe function requires unsafe function or block
+}
+
+
diff --git a/src/test/compile-fail/native-unsafe-fn-called.rs b/src/test/compile-fail/native-unsafe-fn-called.rs
deleted file mode 100644 (file)
index b24a4cf..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-// -*- rust -*-
-
-#[abi = "cdecl"]
-native mod test {
-    unsafe fn free();
-}
-
-fn main() {
-    test::free();
-    //~^ ERROR access to unsafe function requires unsafe function or block
-}
-
diff --git a/src/test/compile-fail/native-unsafe-fn.rs b/src/test/compile-fail/native-unsafe-fn.rs
deleted file mode 100644 (file)
index fd2ace2..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// -*- rust -*-
-
-#[abi = "cdecl"]
-native mod test {
-    unsafe fn free();
-}
-
-fn main() {
-    let x = test::free;
-    //~^ ERROR access to unsafe function requires unsafe function or block
-}
-
-
index 07efff7571c33854ed8f3854aa74300be30a7abb..713c8033a0e3384271fec0f18b1711b381f48188 100644 (file)
@@ -6,6 +6,6 @@
 
 #[link_args = "aFdEfSeVEEE"]
 #[nolink]
-native mod m1 { }
+extern mod m1 { }
 
 fn main() { }
\ No newline at end of file
index ca06125880e3d153eb6f2eac53df8c978bd7c80c..6a316886fe0312d21427284c48a443c38b7ea843 100644 (file)
@@ -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 {
 }
index 3559df78b7dd13f5aea89e052d0f7cdee666b916..319d17e144135e612cddd2a37c23c395cf9ecf25 100644 (file)
@@ -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.
 }
index 1c6966324fcf12653e5569af766655778443c78a..8ee712cb96f9f32bc2e6ec6daebc3f8b55624327 100644 (file)
@@ -2,7 +2,7 @@
 #[warn(err_ctypes)];
 
 #[nolink]
-native mod libc {
+extern mod libc {
     fn malloc(size: int) -> *u8;
 }
 
index 4056f1dbdb4244ff0fe902736e4cf3fa983d8338..bfa1057a1f94cc1545e2e1c05d335a5aea4d9a79 100644 (file)
@@ -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-foreign-int-types.rs b/src/test/compile-fail/warn-foreign-int-types.rs
new file mode 100644 (file)
index 0000000..4ff7d0e
--- /dev/null
@@ -0,0 +1,10 @@
+//error-pattern:libc::c_int or libc::c_long should be used
+extern mod xx {
+  fn strlen(str: *u8) -> uint;
+  fn foo(x: int, y: uint);
+}
+
+fn main() {
+  // let it fail to verify warning message
+  fail
+}
diff --git a/src/test/compile-fail/warn-native-int-types.rs b/src/test/compile-fail/warn-native-int-types.rs
deleted file mode 100644 (file)
index 70c9e72..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-//error-pattern:libc::c_int or libc::c_long should be used
-native mod xx {
-  fn strlen(str: *u8) -> uint;
-  fn foo(x: int, y: uint);
-}
-
-fn main() {
-  // let it fail to verify warning message
-  fail
-}
index 8dac4036c0aab5a4488ab46c5275c05d554ab5e2..a5929248aafcbd389fc5f0ceb6ce7e5d2472af24 100644 (file)
@@ -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;
 }
index 9ecc3c6a07b0488a51f22551076f9d13130d2f65..0fce54cb82161993f0c7a7a184aee610facdcefc 100644 (file)
@@ -7,7 +7,7 @@
 
 use std;
 
-native mod rustrt {
+extern mod rustrt {
     fn last_os_error() -> str;
 }
 
index 155195b0428f450a33cb4aa12b43c7ec6d6b53c6..7bae808504ba94d329e5ba48cb98b612da721353 100644 (file)
@@ -115,7 +115,7 @@ fn h(_i: int) { }
 
 #[abi = "cdecl"]
 #[nolink]
-native mod test {
+extern mod test {
     fn unsupervise();
     fn get_task_id();
 }
index e9de12921d37343719bbf3ab453443387af9e46d..1b10798166db3f76a20d381c4a34555b6d17cd05 100644 (file)
@@ -1,5 +1,5 @@
 #[abi = "cdecl"]
-native mod rustrt {
+extern mod rustrt {
     fn unsupervise();
 }
 
index 162657d4190480a744690727f457faece0b325b9..4c7c2af982b4753302f009fdebcc6b7fe153433a 100644 (file)
@@ -3,7 +3,7 @@
 
 #[abi = "cdecl"]
 #[nolink]
-native mod libc {
+extern mod libc {
     fn atol(x: *u8) -> int;
     fn atoll(x: *u8) -> i64;
 }
index 8c539cd8328e994e3b9e3dbd291e11a9e0bc2ebf..f7d113cdbfc69e2afd4b61e80b138e33c5c784ee 100644 (file)
@@ -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;
   }
index 70cf440949d0e9e7cc7f8799c933c967558dbbb8..d1510e8de47c71514fcb809d5d224aeb4e65ab8c 100644 (file)
@@ -5,14 +5,14 @@
 
 #[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 f() { }
 
 mod test_foreign_items {
     #[abi = "cdecl"]
-    native mod rustrt {
+    extern mod rustrt {
         #[cfg(bogus)]
         fn vec_from_buf_shared();
         fn vec_from_buf_shared();
index 5a8a9fb285cd3e6fe0133aead2a3ccb4a20b125d..e3eb85a1a99666b75a78f038f0cf321273bf2de7 100644 (file)
@@ -1,4 +1,4 @@
-native mod rustrt {
+extern mod rustrt {
     fn rust_dbg_call(cb: *u8,
                      data: libc::uintptr_t) -> libc::uintptr_t;
 }
index ff6ee8ec35abecae6cda5e34598cf95fb75dd769..a4aa0dba4417524f256324f86f361495c58e8ad4 100644 (file)
@@ -1,4 +1,4 @@
-native mod rustrt {
+extern mod rustrt {
     fn rust_dbg_call(cb: *u8,
                      data: libc::uintptr_t) -> libc::uintptr_t;
 }
index 3b2d0a4ba29e6867b7ccad7f6f920fa794e467b1..fe94af2b2e6834ef68c8e06867db3df52d7374cd 100644 (file)
@@ -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;
 }
index f81c0d302f07c039da946659365f1c5e92ee2db1..1a4c7bce2a5ee54057f6d97b2e547cd464856897 100644 (file)
@@ -1,4 +1,4 @@
-native mod rustrt {
+extern mod rustrt {
     fn rust_dbg_call(cb: *u8,
                      data: libc::uintptr_t) -> libc::uintptr_t;
 }
index 170dffdeb5e67ba4c3f00dd5cf401b0f3b9d4be4..fa28dc7217a237ebe35016279bfa620f7ebfd65a 100644 (file)
@@ -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;
 }
index d6d6e9b0bd2178b5e458727796d1b5cdfc228fea..6d5da38ef31712972cec83dfab5ed4cf7567a8c1 100644 (file)
@@ -1,4 +1,4 @@
-native mod rustrt {
+extern mod rustrt {
     fn rust_dbg_call(cb: *u8,
                      data: libc::uintptr_t) -> libc::uintptr_t;
 }
index 19be1e81b666c640e6dcf96cd9172d56576797b7..9fbe930b7f7fa4a8e86a741a997662244d7d8da3 100644 (file)
@@ -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);
index a9d0e3e077dab3d1b59ccf4bf170439475e550b7..7f1a983ce7bc439983346caf8457b0dca1d69db7 100644 (file)
@@ -1,8 +1,8 @@
-fn fix_help<A, B>(f: native fn(fn@(A) -> B, A) -> B, x: A) -> B {
+fn fix_help<A, B>(f: extern fn(fn@(A) -> B, A) -> B, x: A) -> B {
     ret f({|a|fix_help(f, a)}, x);
 }
 
-fn fix<A, B>(f: native fn(fn@(A) -> B, A) -> B) -> fn@(A) -> B {
+fn fix<A, B>(f: extern fn(fn@(A) -> B, A) -> B) -> fn@(A) -> B {
     ret {|a|fix_help(f, a)};
 }
 
index 75315243a7452a456020268a3a5ba1c04a1d3dd2..be9354d015a5aad41cc13f22748e34311b840cc0 100644 (file)
@@ -1,8 +1,8 @@
-fn fix_help<A, B: send>(f: native fn(fn@(A) -> B, A) -> B, x: A) -> B {
+fn fix_help<A, B: send>(f: extern fn(fn@(A) -> B, A) -> B, x: A) -> B {
     ret f({|a|fix_help(f, a)}, x);
 }
 
-fn fix<A, B: send>(f: native fn(fn@(A) -> B, A) -> B) -> fn@(A) -> B {
+fn fix<A, B: send>(f: extern fn(fn@(A) -> B, A) -> B) -> fn@(A) -> B {
     ret {|a|fix_help(f, a)};
 }
 
index 1b5504e8b86796c0a76af5d977476734bf0a051c..ea1e0ee7e37e550f942e9dae2f821148464437a6 100644 (file)
@@ -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);
 }
 
index e05ceb809b850bfd04d78fd931ddfece5c87458f..4ad9b5090cc71d904181a7ef1b66d67c11fe7033 100644 (file)
@@ -1,6 +1,6 @@
 // This is what the signature to spawn should look like with bare functions
 
-fn spawn<T: send>(val: T, f: native fn(T)) {
+fn spawn<T: send>(val: T, f: extern fn(T)) {
     f(val);
 }
 
index 6cf3cc456da546a05d3b6cb46d03265ac99ecc70..bc3eae6e707dc9a8f89aca1893192597e356eb63 100644 (file)
@@ -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/foreign-dupe.rs b/src/test/run-pass/foreign-dupe.rs
new file mode 100644 (file)
index 0000000..ab6a732
--- /dev/null
@@ -0,0 +1,19 @@
+// xfail-fast - Somehow causes check-fast to livelock?? Probably because we're
+// calling pin_task and that's having wierd side-effects.
+
+#[abi = "cdecl"]
+#[link_name = "rustrt"]
+extern mod rustrt1 {
+    fn last_os_error() -> str;
+}
+
+#[abi = "cdecl"]
+#[link_name = "rustrt"]
+extern mod rustrt2 {
+    fn last_os_error() -> str;
+}
+
+fn main() {
+    rustrt1::last_os_error();
+    rustrt2::last_os_error();
+}
diff --git a/src/test/run-pass/foreign-fn-linkname.rs b/src/test/run-pass/foreign-fn-linkname.rs
new file mode 100644 (file)
index 0000000..46fa8cf
--- /dev/null
@@ -0,0 +1,22 @@
+use std;
+
+import vec;
+import str;
+
+#[nolink]
+#[abi = "cdecl"]
+extern mod libc {
+    #[link_name = "strlen"]
+    fn my_strlen(str: *u8) -> uint;
+}
+
+fn strlen(str: str) -> uint unsafe {
+    // C string is terminated with a zero
+    let bytes = str::bytes(str) + ~[0u8];
+    ret libc::my_strlen(vec::unsafe::to_ptr(bytes));
+}
+
+fn main() {
+    let len = strlen("Rust");
+    assert(len == 4u);
+}
diff --git a/src/test/run-pass/foreign-lib-path.rs b/src/test/run-pass/foreign-lib-path.rs
new file mode 100644 (file)
index 0000000..99bf3c7
--- /dev/null
@@ -0,0 +1,14 @@
+// xfail-test FIXME I don't know how to test this (#2604)
+// compile-flags:-L.
+// 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.
+extern mod WHATGOESHERE {
+    fn IDONTKNOW() -> u32;
+}
+
+fn main() {
+    assert IDONTKNOW() == 0x_BAD_DOOD_u32;
+}
\ No newline at end of file
diff --git a/src/test/run-pass/foreign-mod-src/inner.rs b/src/test/run-pass/foreign-mod-src/inner.rs
new file mode 100644 (file)
index 0000000..bee820c
--- /dev/null
@@ -0,0 +1,14 @@
+
+
+
+// -*- rust -*-
+fn main() {
+    let f = "Makefile";
+    let s = rustrt.str_buf(f);
+    let buf = libc.malloc(1024);
+    let fd = libc.open(s, 0, 0);
+    libc.read(fd, buf, 1024);
+    libc.write(1, buf, 1024);
+    libc.close(fd);
+    libc.free(buf);
+}
diff --git a/src/test/run-pass/foreign-mod.rc b/src/test/run-pass/foreign-mod.rc
new file mode 100644 (file)
index 0000000..fe65719
--- /dev/null
@@ -0,0 +1,17 @@
+// xfail-test
+// -*- rust -*-
+
+native mod libc = target_libc {
+  fn open(int name, int flags, int mode) -> int;
+  fn close(int fd) -> int;
+  fn read(int fd, int buf, int count) -> int;
+  fn write(int fd, int buf, int count) -> int;
+  fn malloc(int sz) -> int;
+  fn free(int p) -> ();
+}
+
+native "cdecl" mod rustrt {
+  fn str_buf(str s) -> int;
+}
+
+mod inner = "native-mod-src/inner.rs";
diff --git a/src/test/run-pass/foreign-no-abi.rs b/src/test/run-pass/foreign-no-abi.rs
new file mode 100644 (file)
index 0000000..6b853b7
--- /dev/null
@@ -0,0 +1,9 @@
+// ABI is cdecl by default
+
+extern mod rustrt {
+    fn unsupervise();
+}
+
+fn main() {
+    rustrt::unsupervise();
+}
\ No newline at end of file
diff --git a/src/test/run-pass/foreign-src/foreign.rs b/src/test/run-pass/foreign-src/foreign.rs
new file mode 100644 (file)
index 0000000..b8ecaca
--- /dev/null
@@ -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/foreign-struct.rs b/src/test/run-pass/foreign-struct.rs
new file mode 100644 (file)
index 0000000..f88f47d
--- /dev/null
@@ -0,0 +1,11 @@
+// xfail-win32
+// Passing enums by value
+
+enum void { }
+
+#[nolink]
+extern mod bindgen {
+    fn printf(++v: void);
+}
+
+fn main() { }
diff --git a/src/test/run-pass/foreign.rc b/src/test/run-pass/foreign.rc
new file mode 100644 (file)
index 0000000..1899339
--- /dev/null
@@ -0,0 +1,13 @@
+// xfail-test
+// -*- rust -*-
+
+native "cdecl" mod rustrt {
+  fn str_buf(str s) -> int;
+}
+
+
+native mod libc = target_libc {
+  fn puts(int s) -> ();
+}
+
+mod user = "native-src/native.rs";
diff --git a/src/test/run-pass/foreign2.rs b/src/test/run-pass/foreign2.rs
new file mode 100644 (file)
index 0000000..b801051
--- /dev/null
@@ -0,0 +1,27 @@
+
+
+#[abi = "cdecl"]
+extern mod rustrt {
+    fn unsupervise();
+}
+
+#[abi = "cdecl"]
+#[nolink]
+extern mod bar { }
+
+#[abi = "cdecl"]
+#[nolink]
+extern mod zed { }
+
+#[abi = "cdecl"]
+#[nolink]
+extern mod libc {
+    fn write(fd: int, buf: *u8,
+             count: core::libc::size_t) -> core::libc::ssize_t;
+}
+
+#[abi = "cdecl"]
+#[nolink]
+extern mod baz { }
+
+fn main(args: ~[str]) { }
index c97411fe5b161ecce44fb036c348c5588211d3cf..e89378fe1b5ecf58d72a772d16098ac134b7e177 100644 (file)
@@ -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);
 }
index 108f9f8e34b2845baf7e45953c303c283e1e08c5..29a1a4482f78236e75d328448d7b043e16202533 100644 (file)
@@ -4,13 +4,13 @@
 
 fn chk(&&a: int) { log(debug, a); assert (a == 1); }
 
-fn apply<T>(produce: native fn() -> T,
-            consume: native fn(T)) {
+fn apply<T>(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::<int>(produce, consume);
 }
index 0d59e7d1e341d515056fe2f622def01ea72d53d8..212a6febef5b9abb3715f35037207fb10228116c 100644 (file)
@@ -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<int>), mapper_done, }
 
diff --git a/src/test/run-pass/import-from-foreign.rs b/src/test/run-pass/import-from-foreign.rs
new file mode 100644 (file)
index 0000000..51cd4ea
--- /dev/null
@@ -0,0 +1,13 @@
+mod spam {
+    fn ham() { }
+    fn eggs() { }
+}
+
+#[abi = "cdecl"]
+extern mod rustrt {
+    import spam::{ham, eggs};
+    export ham;
+    export eggs;
+}
+
+fn main() { rustrt::ham(); rustrt::eggs(); }
diff --git a/src/test/run-pass/import-from-native.rs b/src/test/run-pass/import-from-native.rs
deleted file mode 100644 (file)
index af19142..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-mod spam {
-    fn ham() { }
-    fn eggs() { }
-}
-
-#[abi = "cdecl"]
-native mod rustrt {
-    import spam::{ham, eggs};
-    export ham;
-    export eggs;
-}
-
-fn main() { rustrt::ham(); rustrt::eggs(); }
index 5542f3b633aa39bd965b7bd834ac4f2e5b74ec2e..6415836988b7bcc4665dc8c432ac838fe0078e00 100644 (file)
@@ -22,7 +22,7 @@ mod a2 {
     //   |   |   |
     #[abi = "cdecl"]
     #[nolink]
-    native mod b1 {
+    extern mod b1 {
         //   |   |   |
         import a1::b2::*;
         //   | <-/  -/
index bc1d75172f096262ca51cc4aebfffbad6f0e9653..d379693de8cf1c9f031586c6aebcb6d2e883e85e 100644 (file)
@@ -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<T>() -> uint;
     fn min_align_of<T>() -> uint;
 }
index d2418abcb7726e7725d40b360a0be29c58cb276b..5170e5b407ba19bd05e2f847e4bd3214289ec8ec 100644 (file)
@@ -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;
index 6af3c7555d0db9809701cb633af35dbdb0c90978..31ea745d162d13c0761f385ac75c32a388e73e51 100644 (file)
@@ -1,5 +1,5 @@
 #[abi = "rust-intrinsic"]
-native mod rusti {
+extern mod rusti {
     fn frame_address(f: fn(*u8));
 }
 
index e47aa36a777ae4cbb87288341aeb7c1a772f6dab..80dcf2a4199823d125f2a99225c4474de80dbbce 100644 (file)
@@ -1,5 +1,5 @@
 #[abi = "rust-intrinsic"]
-native mod rusti {
+extern mod rusti {
     fn move_val_init<T>(&dst: T, -src: T);
     fn move_val<T>(&dst: T, -src: T);
 }
index 69e54f4a95d7df3496f2b673a4cf9d3d9c814bef..0a73daa234d54bf199c0e0a7610e89b72667becd 100644 (file)
@@ -1,6 +1,6 @@
 #[link(name = "unsupervise")];
 
-native mod rustrt {
+extern mod rustrt {
       fn unsupervise();
 }
 
index 8035ad5f038d035d2041e3816a013593ca241c6f..c7219fbc2d945410cc3e30a230918216e2bed219 100644 (file)
@@ -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;
     }
 }
index 6795375e8699936e9a3c766ac1a809207156be88..7847ef3c8e0a563c29253cba89042e9ae7915bc4 100644 (file)
@@ -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;
index 458a0b12698b80597c24548e27a81e032eb1400d..1c73de5b0c880dc382c8f65ff247b60041b5a422 100644 (file)
@@ -6,7 +6,7 @@
 import task;
 
 #[abi = "cdecl"]
-native mod rustrt {
+extern mod rustrt {
     fn rust_task_allow_kill();
 }
 
index 2f10b0ef1ffc3e2d84ff5058dbf272c4d8cfa39e..bcb70aba648a0ffd324142b8b01f830d89a67abf 100644 (file)
@@ -30,7 +30,7 @@ mod mod1 { }
 
     #[attr = "val"]
     #[abi = "cdecl"]
-    native mod rustrt { }
+    extern mod rustrt { }
 }
 
 mod test_multi_attr_outer {
@@ -50,7 +50,7 @@ mod mod1 { }
     #[attr1 = "val"]
     #[attr2 = "val"]
     #[abi = "cdecl"]
-    native mod rustrt { }
+    extern mod rustrt { }
 
     #[attr1 = "val"]
     #[attr2 = "val"]
@@ -74,7 +74,7 @@ mod mod1 {
 
         #[attr = "val"]
         #[abi = "cdecl"]
-        native mod rustrt {
+        extern mod rustrt {
         }
         */
     }
@@ -101,7 +101,7 @@ mod mod1 {
         #[attr1 = "val"]
         #[attr2 = "val"]
         #[abi = "cdecl"]
-        native mod rustrt {
+        extern mod rustrt {
         }
         */
     }
@@ -159,7 +159,7 @@ fn f() { }
 
 mod test_foreign_items {
     #[abi = "cdecl"]
-    native mod rustrt {
+    extern mod rustrt {
         #[attr];
 
         #[attr]
index eb0f71e67edd23ce098465993c72a4c1711d4b28..69a904e00cdd8d14481c14e92418335bf4efeb83 100644 (file)
@@ -5,7 +5,7 @@
 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-dupe.rs b/src/test/run-pass/native-dupe.rs
deleted file mode 100644 (file)
index 139189f..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// xfail-fast - Somehow causes check-fast to livelock?? Probably because we're
-// calling pin_task and that's having wierd side-effects.
-
-#[abi = "cdecl"]
-#[link_name = "rustrt"]
-native mod rustrt1 {
-    fn last_os_error() -> str;
-}
-
-#[abi = "cdecl"]
-#[link_name = "rustrt"]
-native mod rustrt2 {
-    fn last_os_error() -> str;
-}
-
-fn main() {
-    rustrt1::last_os_error();
-    rustrt2::last_os_error();
-}
diff --git a/src/test/run-pass/native-fn-linkname.rs b/src/test/run-pass/native-fn-linkname.rs
deleted file mode 100644 (file)
index e25b34e..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-use std;
-
-import vec;
-import str;
-
-#[nolink]
-#[abi = "cdecl"]
-native mod libc {
-    #[link_name = "strlen"]
-    fn my_strlen(str: *u8) -> uint;
-}
-
-fn strlen(str: str) -> uint unsafe {
-    // C string is terminated with a zero
-    let bytes = str::bytes(str) + ~[0u8];
-    ret libc::my_strlen(vec::unsafe::to_ptr(bytes));
-}
-
-fn main() {
-    let len = strlen("Rust");
-    assert(len == 4u);
-}
diff --git a/src/test/run-pass/native-lib-path.rs b/src/test/run-pass/native-lib-path.rs
deleted file mode 100644 (file)
index 288be15..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// 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
-
-// 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 {
-    fn IDONTKNOW() -> u32;
-}
-
-fn main() {
-    assert IDONTKNOW() == 0x_BAD_DOOD_u32;
-}
\ No newline at end of file
diff --git a/src/test/run-pass/native-mod-src/inner.rs b/src/test/run-pass/native-mod-src/inner.rs
deleted file mode 100644 (file)
index bee820c..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-// -*- rust -*-
-fn main() {
-    let f = "Makefile";
-    let s = rustrt.str_buf(f);
-    let buf = libc.malloc(1024);
-    let fd = libc.open(s, 0, 0);
-    libc.read(fd, buf, 1024);
-    libc.write(1, buf, 1024);
-    libc.close(fd);
-    libc.free(buf);
-}
diff --git a/src/test/run-pass/native-mod.rc b/src/test/run-pass/native-mod.rc
deleted file mode 100644 (file)
index fe65719..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// xfail-test
-// -*- rust -*-
-
-native mod libc = target_libc {
-  fn open(int name, int flags, int mode) -> int;
-  fn close(int fd) -> int;
-  fn read(int fd, int buf, int count) -> int;
-  fn write(int fd, int buf, int count) -> int;
-  fn malloc(int sz) -> int;
-  fn free(int p) -> ();
-}
-
-native "cdecl" mod rustrt {
-  fn str_buf(str s) -> int;
-}
-
-mod inner = "native-mod-src/inner.rs";
diff --git a/src/test/run-pass/native-no-abi.rs b/src/test/run-pass/native-no-abi.rs
deleted file mode 100644 (file)
index 615a139..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-// ABI is cdecl by default
-
-native mod rustrt {
-    fn unsupervise();
-}
-
-fn main() {
-    rustrt::unsupervise();
-}
\ No newline at end of file
diff --git a/src/test/run-pass/native-src/native.rs b/src/test/run-pass/native-src/native.rs
deleted file mode 100644 (file)
index 164c55d..0000000
+++ /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/native-struct.rs b/src/test/run-pass/native-struct.rs
deleted file mode 100644 (file)
index 8f8ddae..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-// xfail-win32
-// Passing enums by value
-
-enum void { }
-
-#[nolink]
-native mod bindgen {
-    fn printf(++v: void);
-}
-
-fn main() { }
diff --git a/src/test/run-pass/native.rc b/src/test/run-pass/native.rc
deleted file mode 100644 (file)
index 1899339..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// xfail-test
-// -*- rust -*-
-
-native "cdecl" mod rustrt {
-  fn str_buf(str s) -> int;
-}
-
-
-native mod libc = target_libc {
-  fn puts(int s) -> ();
-}
-
-mod user = "native-src/native.rs";
diff --git a/src/test/run-pass/native2.rs b/src/test/run-pass/native2.rs
deleted file mode 100644 (file)
index 377d731..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-#[abi = "cdecl"]
-native mod rustrt {
-    fn unsupervise();
-}
-
-#[abi = "cdecl"]
-#[nolink]
-native mod bar { }
-
-#[abi = "cdecl"]
-#[nolink]
-native mod zed { }
-
-#[abi = "cdecl"]
-#[nolink]
-native mod libc {
-    fn write(fd: int, buf: *u8,
-             count: core::libc::size_t) -> core::libc::ssize_t;
-}
-
-#[abi = "cdecl"]
-#[nolink]
-native mod baz { }
-
-fn main(args: ~[str]) { }
index 32fde0f4edc491bef41008c27af1f795cb3c14b0..f6a9be124f309891291bd2e61cc4ac03a2ac5620 100644 (file)
@@ -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-foreign.rs b/src/test/run-pass/nil-decl-in-foreign.rs
new file mode 100644 (file)
index 0000000..b35b81b
--- /dev/null
@@ -0,0 +1,6 @@
+// Issue #901
+#[nolink]
+extern mod libc {
+    fn printf(x: ());
+}
+fn main() { }
\ No newline at end of file
diff --git a/src/test/run-pass/nil-decl-in-native.rs b/src/test/run-pass/nil-decl-in-native.rs
deleted file mode 100644 (file)
index 126a1a3..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-// Issue #901
-#[nolink]
-native mod libc {
-    fn printf(x: ());
-}
-fn main() { }
\ No newline at end of file
index 89f3305bf79d23ca11ebc645aef40bab34238f81..3f109d78e521454e86e04fc4f359559b8c9fa627 100644 (file)
@@ -2,7 +2,7 @@
 // Issue #2303
 
 #[abi = "rust-intrinsic"]
-native mod rusti {
+extern mod rusti {
     fn pref_align_of<T>() -> uint;
     fn min_align_of<T>() -> uint;
 }
index 39646bb04e0a320c48a64f4e9cf3289f341acb50..2476cf7d8183aa7ea04444690094929d79254efb 100644 (file)
@@ -2,7 +2,7 @@
 // Issue #2303
 
 #[abi = "rust-intrinsic"]
-native mod rusti {
+extern mod rusti {
     fn pref_align_of<T>() -> uint;
     fn min_align_of<T>() -> uint;
 }
index 2cc23c1daad4c9469d48388c2475398246e0e6d7..21fe5461789c27ae8542d112269d4b15a8ec67a3 100644 (file)
@@ -1,6 +1,6 @@
 class finish<T: copy> {
-  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); }
index 553ee0a88c18b15bae8a18040cab6330e9e35a2e..a30b1964bda550add718fc3153d02b54ba5e3fd3 100644 (file)
@@ -8,7 +8,7 @@
 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;
index ba56b12d8f746613f5a1c2094101babea84f86a5..bc8ecd7047a468c0697655b72a793e66e2cf8946 100644 (file)
@@ -23,7 +23,7 @@ fn test05_start(&&f: fn~(&&float, &&str) -> pair<float, str>) {
     assert q.b == "Ho";
 }
 
-fn spawn<A: copy, B: copy>(f: native fn(fn~(A,B)->pair<A,B>)) {
+fn spawn<A: copy, B: copy>(f: extern fn(fn~(A,B)->pair<A,B>)) {
     let arg = fn~(a: A, b: B) -> pair<A,B> {
         ret make_generic_record(a, b);
     };
index 63385b8e4d51a615c9503f1dcb0ea53e975c31e9..34108f30f2dd415cf590d31b714df8493d9253ef 100644 (file)
@@ -2,7 +2,7 @@
 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;
 }
index a5cb9c6f5fae67f1a03da959037ea8eecf6a29ab..c2d38c67aaf5aa82ead4a014cc8b600a9d9ae852 100644 (file)
@@ -6,13 +6,13 @@
 
 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); }
index 4d5f4a2fd17720289d6ca30a55b4542763f7b647..a2afde8d73f32b9eb39c13c0ffc2c0e513c1a895 100644 (file)
@@ -1,5 +1,5 @@
 
 
-type lteq<T> = native fn(T) -> bool;
+type lteq<T> = extern fn(T) -> bool;
 
 fn main(args: ~[str]) { }
index 5400faa1df50de5fc5b9d02411a3c41beac7b867..bbaafa6770de528b5b1d79baa0e9375e5fa8caaf 100644 (file)
@@ -5,7 +5,7 @@ fn range(lo: uint, hi: uint, it: fn(uint)) {
     while lo_ < hi { it(lo_); lo_ += 1u; }
 }
 
-fn create_index<T>(index: ~[{a: T, b: uint}], hash_fn: native fn(T) -> uint) {
+fn create_index<T>(index: ~[{a: T, b: uint}], hash_fn: extern fn(T) -> uint) {
     range(0u, 256u, |_i| { let bucket: ~[T] = ~[]; } )
 }
 
index d0df4228779d11f8b7ad8303d1bc8a7255d82eed..1ce376f07a4b0f180cbb728312e23f6c4545e5ef 100644 (file)
@@ -3,7 +3,7 @@
 #[warn(no_ctypes)];
 
 #[nolink]
-native mod libc {
+extern mod libc {
     fn malloc(size: int) -> *u8;
 }
 
index b9d9b84a526c75473718e940b786df8da55271ee..3185080103410b4552554db05bd40335b9780504 100644 (file)
@@ -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;
 }
index e58656a73a44f39fcc66f5a68e23ac2dea7a888a..423bafae452393539f608deb593a877eff3f7404 100644 (file)
@@ -6,7 +6,7 @@
 
 #[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;