librustc: Remove "extern mod { ... }" from librustc, librustdoc, and tests. rs=deexterning

This commit is contained in:
Patrick Walton 2013-03-05 14:42:58 -08:00
parent 87e44af2f2
commit 6b5d1afeec
62 changed files with 1594 additions and 1338 deletions

View File

@ -1139,8 +1139,8 @@ pub mod funcs {
unsafe fn strxfrm(s: *c_char, ct: *c_char, n: size_t)
-> size_t;
// These are fine to execute on the Rust stack. They must be, in
// fact, because LLVM generates calls to them!
// These are fine to execute on the Rust stack. They must be,
// in fact, because LLVM generates calls to them!
#[rust_stack]
#[inline(always)]
unsafe fn memcpy(s: *c_void, ct: *c_void, n: size_t)

View File

@ -94,10 +94,12 @@ pub mod jit {
use core::ptr;
use core::str;
#[nolink]
#[abi = "rust-intrinsic"]
pub extern mod rusti {
pub fn morestack_addr() -> *();
pub mod rusti {
#[nolink]
#[abi = "rust-intrinsic"]
pub extern {
pub fn morestack_addr() -> *();
}
}
pub struct Closure {

View File

@ -122,9 +122,13 @@ pub mod intrinsic {
fn visit_closure_ptr(&self, ck: uint) -> bool;
}
#[abi = "rust-intrinsic"]
pub extern mod rusti {
pub fn get_tydesc<T>() -> *();
pub fn visit_tydesc(++td: *TyDesc, &&tv: TyVisitor);
pub mod rusti {
use super::{TyDesc, TyVisitor};
#[abi = "rust-intrinsic"]
pub extern {
pub fn get_tydesc<T>() -> *();
pub fn visit_tydesc(++td: *TyDesc, &&tv: TyVisitor);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -135,15 +135,9 @@ fn should_extract_top_mod_attributes() {
assert doc.cratemod().desc() == Some(~"test");
}
#[test]
fn should_extract_foreign_mod_attributes() {
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(~"extern mod a { #[doc = \"test\"] fn a(); }");
let doc = test::mk_doc(~"extern { #[doc = \"test\"] fn a(); }");
assert doc.cratemod().nmods()[0].fns[0].desc() == Some(~"test");
}

View File

@ -371,15 +371,9 @@ mod test {
assert doc.cratemod().mods()[0].mods()[1].name() == ~"c";
}
#[test]
pub fn extract_foreign_mods() {
let doc = mk_doc(~"extern mod a { }");
assert doc.cratemod().nmods()[0].name() == ~"a";
}
#[test]
pub fn extract_fns_from_foreign_mods() {
let doc = mk_doc(~"extern mod a { fn a(); }");
let doc = mk_doc(~"extern { fn a(); }");
assert doc.cratemod().nmods()[0].fns[0].name() == ~"a";
}

View File

@ -169,18 +169,6 @@ fn should_remove_mods_from_containing_mods() {
assert vec::is_empty(doc.cratemod().mods());
}
#[test]
fn should_make_a_page_for_every_foreign_mod() {
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(~"extern mod a { }");
assert vec::is_empty(doc.cratemod().nmods());
}
#[cfg(test)]
mod test {
use astsrv;

View File

@ -115,22 +115,3 @@ fn should_record_fn_paths() {
}
}
#[test]
fn should_record_foreign_mod_paths() {
let source = ~"mod a { extern mod b { } }";
do astsrv::from_str(source) |srv| {
let doc = extract::from_srv(srv.clone(), ~"");
let doc = run(srv.clone(), doc);
assert doc.cratemod().mods()[0].nmods()[0].path() == ~[~"a"];
}
}
#[test]
fn should_record_foreign_fn_paths() {
let source = ~"extern mod a { fn b(); }";
do astsrv::from_str(source) |srv| {
let doc = extract::from_srv(srv.clone(), ~"");
let doc = run(srv.clone(), doc);
assert doc.cratemod().nmods()[0].fns[0].path() == ~[~"a"];
}
}

View File

@ -786,9 +786,11 @@ pub mod rustrt {
unsafe fn rust_uv_tcp_bind6(tcp_server: *uv_tcp_t,
++addr: *sockaddr_in6) -> libc::c_int;
unsafe fn rust_uv_tcp_getpeername(tcp_handle_ptr: *uv_tcp_t,
++name: *sockaddr_in) -> libc::c_int;
++name: *sockaddr_in)
-> libc::c_int;
unsafe fn rust_uv_tcp_getpeername6(tcp_handle_ptr: *uv_tcp_t,
++name: *sockaddr_in6) ->libc::c_int;
++name: *sockaddr_in6)
-> libc::c_int;
unsafe fn rust_uv_listen(stream: *libc::c_void,
backlog: libc::c_int,
cb: *u8) -> libc::c_int;
@ -852,7 +854,8 @@ pub mod rustrt {
-> *libc::c_void;
unsafe fn rust_uv_set_data_for_uv_handle(handle: *libc::c_void,
data: *libc::c_void);
unsafe fn rust_uv_get_data_for_req(req: *libc::c_void) -> *libc::c_void;
unsafe fn rust_uv_get_data_for_req(req: *libc::c_void)
-> *libc::c_void;
unsafe fn rust_uv_set_data_for_req(req: *libc::c_void,
data: *libc::c_void);
unsafe fn rust_uv_get_base_from_buf(++buf: uv_buf_t) -> *u8;

View File

@ -8,23 +8,25 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[abi = "rust-intrinsic"]
pub extern mod rusti {
fn atomic_cxchg(dst: &mut int, old: int, src: int) -> int;
fn atomic_cxchg_acq(dst: &mut int, old: int, src: int) -> int;
fn atomic_cxchg_rel(dst: &mut int, old: int, src: int) -> int;
pub mod rusti {
#[abi = "rust-intrinsic"]
pub extern {
fn atomic_cxchg(dst: &mut int, old: int, src: int) -> int;
fn atomic_cxchg_acq(dst: &mut int, old: int, src: int) -> int;
fn atomic_cxchg_rel(dst: &mut int, old: int, src: int) -> int;
fn atomic_xchg(dst: &mut int, src: int) -> int;
fn atomic_xchg_acq(dst: &mut int, src: int) -> int;
fn atomic_xchg_rel(dst: &mut int, src: int) -> int;
fn atomic_xadd(dst: &mut int, src: int) -> int;
fn atomic_xadd_acq(dst: &mut int, src: int) -> int;
fn atomic_xadd_rel(dst: &mut int, src: int) -> int;
fn atomic_xsub(dst: &mut int, src: int) -> int;
fn atomic_xsub_acq(dst: &mut int, src: int) -> int;
fn atomic_xsub_rel(dst: &mut int, src: int) -> int;
fn atomic_xchg(dst: &mut int, src: int) -> int;
fn atomic_xchg_acq(dst: &mut int, src: int) -> int;
fn atomic_xchg_rel(dst: &mut int, src: int) -> int;
fn atomic_xadd(dst: &mut int, src: int) -> int;
fn atomic_xadd_acq(dst: &mut int, src: int) -> int;
fn atomic_xadd_rel(dst: &mut int, src: int) -> int;
fn atomic_xsub(dst: &mut int, src: int) -> int;
fn atomic_xsub_acq(dst: &mut int, src: int) -> int;
fn atomic_xsub_rel(dst: &mut int, src: int) -> int;
}
}
#[inline(always)]

View File

@ -13,9 +13,11 @@
#[crate_type = "lib"];
pub extern mod rustrt {
pub fn rust_dbg_call(cb: *u8,
data: libc::uintptr_t) -> libc::uintptr_t;
pub mod rustrt {
pub extern {
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
-> libc::uintptr_t;
}
}
pub fn fact(n: uint) -> uint {

View File

@ -10,6 +10,9 @@
#[link(name="foreign_lib", vers="0.0")];
pub extern mod rustrt {
pub fn rust_get_argc() -> libc::c_int;
pub mod rustrt {
pub extern {
pub fn rust_get_argc() -> libc::c_int;
}
}

View File

@ -13,7 +13,9 @@ mod issue_3882 {
len: libc::size_t,
}
extern mod c {
fn linenoiseAddCompletion(lc: *mut Completions);
mod c {
extern {
fn linenoiseAddCompletion(lc: *mut Completions);
}
}
}

View File

@ -20,9 +20,11 @@ use core::os;
// because the the indirection through another dynamic linker
// stub. Kind of shocking. Might be able to make it faster still with
// an llvm intrinsic.
#[nolink]
extern mod libc {
pub fn sqrt(n: float) -> float;
mod libc {
#[nolink]
pub extern {
pub fn sqrt(n: float) -> float;
}
}
fn main() {

View File

@ -11,5 +11,5 @@
// error-pattern:empty #[link_name] not allowed; use #[nolink].
#[link_name = ""]
extern mod foo {
extern {
}

View File

@ -13,5 +13,5 @@
#[link_name = ""]
#[nolink]
extern mod foo {
extern {
}

View File

@ -10,9 +10,11 @@
// except according to those terms.
#[abi = "cdecl"]
extern mod test {
pub unsafe fn free();
mod test {
#[abi = "cdecl"]
pub extern {
pub unsafe fn free();
}
}
fn main() {

View File

@ -10,9 +10,11 @@
// except according to those terms.
#[abi = "cdecl"]
extern mod test {
pub unsafe fn free();
mod test {
#[abi = "cdecl"]
pub extern {
pub unsafe fn free();
}
}
fn main() {

View File

@ -16,6 +16,6 @@ the compiler output. */
#[link_args = "aFdEfSeVEEE"]
#[nolink]
extern mod m1 {}
extern {}
fn main() { }

View File

@ -18,10 +18,10 @@
#[link_name= "m"]
#[link_args="-foo"] // this could have been elided.
extern mod m1 {
extern {
}
#[link_name= "m"]
#[link_args="-bar"] // this is the actual error trigger.
extern mod m2 {
extern {
}

View File

@ -11,9 +11,11 @@
// error-pattern:found rust type
#[deny(ctypes)];
#[nolink]
extern mod libc {
pub fn malloc(size: int) -> *u8;
mod libc {
#[nolink]
pub extern {
pub fn malloc(size: int) -> *u8;
}
}
fn main() {

View File

@ -10,9 +10,11 @@
// compile-flags:-D ctypes
// error-pattern:found rust type
#[nolink]
extern mod libc {
pub fn malloc(size: int) -> *u8;
mod libc {
#[nolink]
extern {
pub fn malloc(size: int) -> *u8;
}
}
fn main() {

View File

@ -9,9 +9,11 @@
// except according to those terms.
//error-pattern:libc::c_int or libc::c_long should be used
extern mod xx {
pub fn strlen(str: *u8) -> uint;
pub fn foo(x: int, y: uint);
mod xx {
pub extern {
pub fn strlen(str: *u8) -> uint;
pub fn foo(x: int, y: uint);
}
}
fn main() {

View File

@ -12,9 +12,11 @@
// Testing that runtime failure doesn't cause callbacks to abort abnormally.
// Instead the failure will be delivered after the callbacks return.
extern mod rustrt {
pub fn rust_dbg_call(cb: *u8,
data: libc::uintptr_t) -> libc::uintptr_t;
mod rustrt {
pub extern {
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
-> libc::uintptr_t;
}
}
extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {

View File

@ -17,8 +17,10 @@
extern mod std;
extern mod rustrt {
pub fn rust_get_argc() -> libc::c_int;
mod rustrt {
pub extern {
pub fn rust_get_argc() -> libc::c_int;
}
}
fn getbig_call_c_and_fail(i: int) {

View File

@ -79,11 +79,13 @@ fn test_ptr() {
}
}
#[abi = "cdecl"]
#[nolink]
extern mod test {
pub fn rust_get_sched_id() -> libc::intptr_t;
pub fn get_task_id() -> libc::intptr_t;
mod test {
#[abi = "cdecl"]
#[nolink]
pub extern {
pub fn rust_get_sched_id() -> libc::intptr_t;
pub fn get_task_id() -> libc::intptr_t;
}
}
#[deriving_eq]

View File

@ -8,9 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[abi = "cdecl"]
extern mod rustrt {
pub fn get_task_id() -> libc::intptr_t;
mod rustrt {
#[abi = "cdecl"]
pub extern {
pub fn get_task_id() -> libc::intptr_t;
}
}
pub fn main() {

View File

@ -10,11 +10,13 @@
extern mod std;
#[abi = "cdecl"]
#[nolink]
extern mod libc {
pub fn atol(x: *u8) -> int;
pub fn atoll(x: *u8) -> i64;
mod libc {
#[abi = "cdecl"]
#[nolink]
pub extern {
pub fn atol(x: *u8) -> int;
pub fn atoll(x: *u8) -> i64;
}
}
fn atol(s: ~str) -> int {

View File

@ -19,17 +19,19 @@ const b: bool = false;
const b: bool = true;
#[cfg(bogus)]
#[abi = "cdecl"]
extern mod rustrt {
// This symbol doesn't exist and would be a link error if this
// module was translated
pub fn bogus();
mod rustrt {
#[cfg(bogus)]
#[abi = "cdecl"]
pub extern {
// This symbol doesn't exist and would be a link error if this
// module was translated
pub fn bogus();
}
#[abi = "cdecl"]
pub extern {}
}
#[abi = "cdecl"]
extern mod rustrt {}
#[cfg(bogus)]
type t = int;
@ -106,11 +108,13 @@ fn test_in_fn_ctxt() {
}
mod test_foreign_items {
#[abi = "cdecl"]
pub extern mod rustrt {
#[cfg(bogus)]
pub fn rust_getcwd() -> ~str;
pub fn rust_getcwd() -> ~str;
pub mod rustrt {
#[abi = "cdecl"]
pub extern {
#[cfg(bogus)]
pub fn rust_getcwd() -> ~str;
pub fn rust_getcwd() -> ~str;
}
}
}
@ -118,9 +122,11 @@ mod test_use_statements {
#[cfg(bogus)]
use flippity_foo;
pub extern mod rustrt {
#[cfg(bogus)]
use flippity_foo;
pub mod rustrt {
pub extern {
#[cfg(bogus)]
use flippity_foo;
}
}
}

View File

@ -8,9 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern mod rustrt {
pub fn rust_dbg_call(cb: *u8,
data: libc::uintptr_t) -> libc::uintptr_t;
mod rustrt {
pub extern {
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
-> libc::uintptr_t;
}
}
extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {

View File

@ -8,9 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern mod rustrt {
pub fn rust_dbg_call(cb: *u8,
data: libc::uintptr_t) -> libc::uintptr_t;
mod rustrt {
pub extern {
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
-> libc::uintptr_t;
}
}
extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {

View File

@ -12,9 +12,11 @@
// make sure the stack pointers are maintained properly in both
// directions
extern mod rustrt {
pub fn rust_dbg_call(cb: *u8,
data: libc::uintptr_t) -> libc::uintptr_t;
mod rustrt {
pub extern {
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
-> libc::uintptr_t;
}
}
extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {

View File

@ -8,9 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern mod rustrt {
pub fn rust_dbg_call(cb: *u8,
data: libc::uintptr_t) -> libc::uintptr_t;
mod rustrt {
pub extern {
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
-> libc::uintptr_t;
}
}
extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {

View File

@ -11,9 +11,11 @@
// This creates a bunch of yielding tasks that run concurrently
// while holding onto C stacks
extern mod rustrt {
pub fn rust_dbg_call(cb: *u8,
data: libc::uintptr_t) -> libc::uintptr_t;
mod rustrt {
pub extern {
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
-> libc::uintptr_t;
}
}
extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {

View File

@ -8,9 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern mod rustrt {
pub fn rust_dbg_call(cb: *u8,
data: libc::uintptr_t) -> libc::uintptr_t;
mod rustrt {
pub extern {
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
-> libc::uintptr_t;
}
}
extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {

View File

@ -11,16 +11,20 @@
// 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 {
pub fn rust_get_argc() -> libc::c_int;
mod rustrt1 {
#[abi = "cdecl"]
#[link_name = "rustrt"]
pub extern {
pub fn rust_get_argc() -> libc::c_int;
}
}
#[abi = "cdecl"]
#[link_name = "rustrt"]
extern mod rustrt2 {
pub fn rust_get_argc() -> libc::c_int;
mod rustrt2 {
#[abi = "cdecl"]
#[link_name = "rustrt"]
pub extern {
pub fn rust_get_argc() -> libc::c_int;
}
}
pub fn main() {

View File

@ -10,12 +10,13 @@
extern mod std;
#[nolink]
#[abi = "cdecl"]
extern mod libc {
#[link_name = "strlen"]
pub fn my_strlen(str: *u8) -> uint;
mod libc {
#[nolink]
#[abi = "cdecl"]
pub extern {
#[link_name = "strlen"]
pub fn my_strlen(str: *u8) -> uint;
}
}
fn strlen(str: ~str) -> uint {

View File

@ -12,11 +12,13 @@
// 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 {
pub fn IDONTKNOW() -> u32;
mod WHATGOESHERE {
// 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.
pub extern {
pub fn IDONTKNOW() -> u32;
}
}
pub fn main() {

View File

@ -8,9 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[nolink]
extern mod foo {
pub const errno: int;
mod foo {
#[nolink]
pub extern {
pub const errno: int;
}
}
pub fn main() {

View File

@ -10,8 +10,10 @@
// ABI is cdecl by default
extern mod rustrt {
pub fn get_task_id() -> libc::intptr_t;
mod rustrt {
pub extern {
pub fn get_task_id() -> libc::intptr_t;
}
}
pub fn main() {

View File

@ -11,11 +11,15 @@
// xfail-win32
// Passing enums by value
enum void { }
pub enum void { }
#[nolink]
extern mod bindgen {
pub fn printf(++v: void);
mod bindgen {
use super::void;
#[nolink]
pub extern {
pub fn printf(++v: void);
}
}
pub fn main() { }

View File

@ -8,23 +8,31 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[abi = "cdecl"]
#[nolink]
extern mod bar {}
#[abi = "cdecl"]
#[nolink]
extern mod zed {}
#[abi = "cdecl"]
#[nolink]
extern mod libc {
pub fn write(fd: int, buf: *u8,
count: ::core::libc::size_t) -> ::core::libc::ssize_t;
mod bar {
#[abi = "cdecl"]
#[nolink]
pub extern {}
}
#[abi = "cdecl"]
#[nolink]
extern mod baz {}
mod zed {
#[abi = "cdecl"]
#[nolink]
pub extern {}
}
mod libc {
#[abi = "cdecl"]
#[nolink]
pub extern {
pub fn write(fd: int, buf: *u8, count: ::core::libc::size_t)
-> ::core::libc::ssize_t;
}
}
mod baz {
#[abi = "cdecl"]
#[nolink]
pub extern {}
}
pub fn main() { }

View File

@ -15,9 +15,11 @@ mod spam {
pub fn eggs() { }
}
#[abi = "cdecl"]
extern mod rustrt {
pub use spam::{ham, eggs};
mod rustrt {
#[abi = "cdecl"]
pub extern {
pub use spam::{ham, eggs};
}
}
pub fn main() { rustrt::ham(); rustrt::eggs(); }

View File

@ -10,10 +10,12 @@
// xfail-fast Does not work with main in a submodule
#[abi = "rust-intrinsic"]
extern mod rusti {
pub fn pref_align_of<T>() -> uint;
pub fn min_align_of<T>() -> uint;
mod rusti {
#[abi = "rust-intrinsic"]
pub extern {
pub fn pref_align_of<T>() -> uint;
pub fn min_align_of<T>() -> uint;
}
}
#[cfg(target_os = "linux")]

View File

@ -8,23 +8,25 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[abi = "rust-intrinsic"]
extern mod rusti {
pub fn atomic_cxchg(dst: &mut int, old: int, src: int) -> int;
pub fn atomic_cxchg_acq(dst: &mut int, old: int, src: int) -> int;
pub fn atomic_cxchg_rel(dst: &mut int, old: int, src: int) -> int;
mod rusti {
#[abi = "rust-intrinsic"]
pub extern {
pub fn atomic_cxchg(dst: &mut int, old: int, src: int) -> int;
pub fn atomic_cxchg_acq(dst: &mut int, old: int, src: int) -> int;
pub fn atomic_cxchg_rel(dst: &mut int, old: int, src: int) -> int;
pub fn atomic_xchg(dst: &mut int, src: int) -> int;
pub fn atomic_xchg_acq(dst: &mut int, src: int) -> int;
pub fn atomic_xchg_rel(dst: &mut int, src: int) -> int;
pub fn atomic_xadd(dst: &mut int, src: int) -> int;
pub fn atomic_xadd_acq(dst: &mut int, src: int) -> int;
pub fn atomic_xadd_rel(dst: &mut int, src: int) -> int;
pub fn atomic_xsub(dst: &mut int, src: int) -> int;
pub fn atomic_xsub_acq(dst: &mut int, src: int) -> int;
pub fn atomic_xsub_rel(dst: &mut int, src: int) -> int;
pub fn atomic_xchg(dst: &mut int, src: int) -> int;
pub fn atomic_xchg_acq(dst: &mut int, src: int) -> int;
pub fn atomic_xchg_rel(dst: &mut int, src: int) -> int;
pub fn atomic_xadd(dst: &mut int, src: int) -> int;
pub fn atomic_xadd_acq(dst: &mut int, src: int) -> int;
pub fn atomic_xadd_rel(dst: &mut int, src: int) -> int;
pub fn atomic_xsub(dst: &mut int, src: int) -> int;
pub fn atomic_xsub_acq(dst: &mut int, src: int) -> int;
pub fn atomic_xsub_rel(dst: &mut int, src: int) -> int;
}
}
pub fn main() {

View File

@ -10,9 +10,12 @@
// xfail-fast
#[legacy_modes];
#[abi = "rust-intrinsic"]
extern mod rusti {
pub fn frame_address(f: &once fn(*u8));
mod rusti {
#[abi = "rust-intrinsic"]
pub extern {
pub fn frame_address(f: &once fn(*u8));
}
}
pub fn main() {

View File

@ -8,10 +8,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[abi = "rust-intrinsic"]
extern mod rusti {
pub fn move_val_init<T>(dst: &mut T, -src: T);
pub fn move_val<T>(dst: &mut T, -src: T);
mod rusti {
#[abi = "rust-intrinsic"]
pub extern {
pub fn move_val_init<T>(dst: &mut T, -src: T);
pub fn move_val<T>(dst: &mut T, -src: T);
}
}
pub fn main() {

View File

@ -12,26 +12,28 @@
extern mod std;
#[abi = "rust-intrinsic"]
extern mod rusti {
fn ctpop8(x: i8) -> i8;
fn ctpop16(x: i16) -> i16;
fn ctpop32(x: i32) -> i32;
fn ctpop64(x: i64) -> i64;
mod rusti {
#[abi = "rust-intrinsic"]
pub extern {
fn ctpop8(x: i8) -> i8;
fn ctpop16(x: i16) -> i16;
fn ctpop32(x: i32) -> i32;
fn ctpop64(x: i64) -> i64;
fn ctlz8(x: i8) -> i8;
fn ctlz16(x: i16) -> i16;
fn ctlz32(x: i32) -> i32;
fn ctlz64(x: i64) -> i64;
fn ctlz8(x: i8) -> i8;
fn ctlz16(x: i16) -> i16;
fn ctlz32(x: i32) -> i32;
fn ctlz64(x: i64) -> i64;
fn cttz8(x: i8) -> i8;
fn cttz16(x: i16) -> i16;
fn cttz32(x: i32) -> i32;
fn cttz64(x: i64) -> i64;
fn cttz8(x: i8) -> i8;
fn cttz16(x: i16) -> i16;
fn cttz32(x: i32) -> i32;
fn cttz64(x: i64) -> i64;
fn bswap16(x: i16) -> i16;
fn bswap32(x: i32) -> i32;
fn bswap64(x: i64) -> i64;
fn bswap16(x: i16) -> i16;
fn bswap32(x: i32) -> i32;
fn bswap64(x: i64) -> i64;
}
}
pub fn main() {

View File

@ -14,38 +14,40 @@ extern mod std;
use std::cmp::FuzzyEq;
#[abi = "rust-intrinsic"]
extern mod rusti {
fn sqrtf32(x: f32) -> f32;
fn sqrtf64(x: f64) -> f64;
fn powif32(a: f32, x: i32) -> f32;
fn powif64(a: f64, x: i32) -> f64;
fn sinf32(x: f32) -> f32;
fn sinf64(x: f64) -> f64;
fn cosf32(x: f32) -> f32;
fn cosf64(x: f64) -> f64;
fn powf32(a: f32, x: f32) -> f32;
fn powf64(a: f64, x: f64) -> f64;
fn expf32(x: f32) -> f32;
fn expf64(x: f64) -> f64;
fn exp2f32(x: f32) -> f32;
fn exp2f64(x: f64) -> f64;
fn logf32(x: f32) -> f32;
fn logf64(x: f64) -> f64;
fn log10f32(x: f32) -> f32;
fn log10f64(x: f64) -> f64;
fn log2f32(x: f32) -> f32;
fn log2f64(x: f64) -> f64;
fn fmaf32(a: f32, b: f32, c: f32) -> f32;
fn fmaf64(a: f64, b: f64, c: f64) -> f64;
fn fabsf32(x: f32) -> f32;
fn fabsf64(x: f64) -> f64;
fn floorf32(x: f32) -> f32;
fn floorf64(x: f64) -> f64;
fn ceilf32(x: f32) -> f32;
fn ceilf64(x: f64) -> f64;
fn truncf32(x: f32) -> f32;
fn truncf64(x: f64) -> f64;
mod rusti {
#[abi = "rust-intrinsic"]
pub extern {
fn sqrtf32(x: f32) -> f32;
fn sqrtf64(x: f64) -> f64;
fn powif32(a: f32, x: i32) -> f32;
fn powif64(a: f64, x: i32) -> f64;
fn sinf32(x: f32) -> f32;
fn sinf64(x: f64) -> f64;
fn cosf32(x: f32) -> f32;
fn cosf64(x: f64) -> f64;
fn powf32(a: f32, x: f32) -> f32;
fn powf64(a: f64, x: f64) -> f64;
fn expf32(x: f32) -> f32;
fn expf64(x: f64) -> f64;
fn exp2f32(x: f32) -> f32;
fn exp2f64(x: f64) -> f64;
fn logf32(x: f32) -> f32;
fn logf64(x: f64) -> f64;
fn log10f32(x: f32) -> f32;
fn log10f64(x: f64) -> f64;
fn log2f32(x: f32) -> f32;
fn log2f64(x: f64) -> f64;
fn fmaf32(a: f32, b: f32, c: f32) -> f32;
fn fmaf64(a: f64, b: f64, c: f64) -> f64;
fn fabsf32(x: f32) -> f32;
fn fabsf64(x: f64) -> f64;
fn floorf32(x: f32) -> f32;
fn floorf64(x: f64) -> f64;
fn ceilf32(x: f32) -> f32;
fn ceilf64(x: f64) -> f64;
fn truncf32(x: f32) -> f32;
fn truncf64(x: f64) -> f64;
}
}
pub fn main() {

View File

@ -10,8 +10,10 @@
#[link(name = "get_task_id")];
extern mod rustrt {
pub fn get_task_id() -> libc::intptr_t;
mod rustrt {
pub extern {
pub fn get_task_id() -> libc::intptr_t;
}
}
pub fn main() { }

View File

@ -11,15 +11,19 @@
// xfail-test
mod a {
pub type rust_task = uint;
pub extern mod rustrt {
pub fn rust_task_is_unwinding(rt: *rust_task) -> bool;
pub mod rustrt {
pub extern {
pub fn rust_task_is_unwinding(rt: *rust_task) -> bool;
}
}
}
mod b {
pub type rust_task = bool;
pub extern mod rustrt {
pub fn rust_task_is_unwinding(rt: *rust_task) -> bool;
pub mod rustrt {
pub extern {
pub fn rust_task_is_unwinding(rt: *rust_task) -> bool;
}
}
}

View File

@ -26,16 +26,19 @@ fn lgamma(n: c_double, value: &mut int) -> c_double {
}
}
#[link_name = "m"]
#[abi = "cdecl"]
extern mod m {
#[cfg(unix)]
#[link_name="lgamma_r"] pub fn lgamma(n: c_double, sign: &mut c_int)
-> c_double;
#[cfg(windows)]
#[link_name="__lgamma_r"] pub fn lgamma(n: c_double,
sign: &mut c_int) -> c_double;
mod m {
use core::libc::{c_double, c_int};
#[link_name = "m"]
#[abi = "cdecl"]
pub extern {
#[cfg(unix)]
#[link_name="lgamma_r"]
pub fn lgamma(n: c_double, sign: &mut c_int) -> c_double;
#[cfg(windows)]
#[link_name="__lgamma_r"]
pub fn lgamma(n: c_double, sign: &mut c_int) -> c_double;
}
}
pub fn main() {

View File

@ -37,9 +37,11 @@ mod test_single_attr_outer {
#[attr = "val"]
pub mod mod1 {}
#[attr = "val"]
#[abi = "cdecl"]
pub extern mod rustrt {}
pub mod rustrt {
#[attr = "val"]
#[abi = "cdecl"]
pub extern {}
}
}
mod test_multi_attr_outer {
@ -55,10 +57,12 @@ mod test_multi_attr_outer {
#[attr2 = "val"]
pub mod mod1 {}
#[attr1 = "val"]
#[attr2 = "val"]
#[abi = "cdecl"]
pub extern mod rustrt {}
pub mod rustrt {
#[attr1 = "val"]
#[attr2 = "val"]
#[abi = "cdecl"]
pub extern {}
}
#[attr1 = "val"]
#[attr2 = "val"]
@ -77,9 +81,11 @@ mod test_stmt_single_attr_outer {
mod mod1 {
}
#[attr = "val"]
#[abi = "cdecl"]
extern mod rustrt {
mod rustrt {
#[attr = "val"]
#[abi = "cdecl"]
pub extern {
}
}
}
}
@ -101,10 +107,12 @@ mod test_stmt_multi_attr_outer {
mod mod1 {
}
#[attr1 = "val"]
#[attr2 = "val"]
#[abi = "cdecl"]
extern mod rustrt {
pub mod rustrt {
#[attr1 = "val"]
#[attr2 = "val"]
#[abi = "cdecl"]
pub extern {
}
}
*/
}
@ -158,12 +166,14 @@ mod test_other_forms {
}
mod test_foreign_items {
#[abi = "cdecl"]
pub extern mod rustrt {
#[attr];
pub mod rustrt {
#[abi = "cdecl"]
pub extern {
#[attr];
#[attr]
fn get_task_id() -> libc::intptr_t;
#[attr]
fn get_task_id() -> libc::intptr_t;
}
}
}

View File

@ -8,10 +8,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[nolink]
#[abi = "rust-intrinsic"]
extern mod rusti {
pub fn morestack_addr() -> *();
mod rusti {
#[nolink]
#[abi = "rust-intrinsic"]
pub extern {
pub fn morestack_addr() -> *();
}
}
pub fn main() {

View File

@ -11,15 +11,17 @@
// This test attempts to force the dynamic linker to resolve
// external symbols as close to the red zone as possible.
extern mod rustrt {
pub fn debug_get_stk_seg() -> *u8;
mod rustrt {
pub extern {
pub fn debug_get_stk_seg() -> *u8;
pub fn rust_get_sched_id() -> libc::intptr_t;
pub fn rust_get_argc() -> libc::c_int;
pub fn rust_getcwd() -> ~str;
pub fn get_task_id() -> libc::intptr_t;
pub fn rust_sched_threads();
pub fn rust_get_task();
pub fn rust_get_sched_id() -> libc::intptr_t;
pub fn rust_get_argc() -> libc::c_int;
pub fn rust_getcwd() -> ~str;
pub fn get_task_id() -> libc::intptr_t;
pub fn rust_sched_threads();
pub fn rust_get_task();
}
}
fn calllink01() { unsafe { rustrt::rust_get_sched_id(); } }

View File

@ -9,8 +9,11 @@
// except according to those terms.
// Issue #901
#[nolink]
extern mod libc {
pub fn printf(x: ());
mod libc {
#[nolink]
pub extern {
pub fn printf(x: ());
}
}
pub fn main() { }

View File

@ -10,10 +10,12 @@
// Issue #2303
#[abi = "rust-intrinsic"]
extern mod rusti {
pub fn pref_align_of<T>() -> uint;
pub fn min_align_of<T>() -> uint;
mod rusti {
#[abi = "rust-intrinsic"]
pub extern {
pub fn pref_align_of<T>() -> uint;
pub fn min_align_of<T>() -> uint;
}
}
// This is the type with the questionable alignment

View File

@ -10,10 +10,12 @@
// Issue #2303
#[abi = "rust-intrinsic"]
extern mod rusti {
pub fn pref_align_of<T>() -> uint;
pub fn min_align_of<T>() -> uint;
mod rusti {
#[abi = "rust-intrinsic"]
pub extern {
pub fn pref_align_of<T>() -> uint;
pub fn min_align_of<T>() -> uint;
}
}
// This is the type with the questionable alignment

View File

@ -12,17 +12,21 @@
use core::comm::*;
type sched_id = int;
type task_id = *libc::c_void;
pub type sched_id = int;
pub type task_id = *libc::c_void;
type task = *libc::c_void;
type closure = *libc::c_void;
pub type task = *libc::c_void;
pub type closure = *libc::c_void;
extern mod rustrt {
pub fn rust_new_sched(num_threads: libc::uintptr_t) -> sched_id;
pub fn rust_get_sched_id() -> sched_id;
pub fn rust_new_task_in_sched(id: sched_id) -> task_id;
pub fn start_task(id: task_id, f: closure);
mod rustrt {
use super::{closure, sched_id, task, task_id};
pub extern {
pub fn rust_new_sched(num_threads: libc::uintptr_t) -> sched_id;
pub fn rust_get_sched_id() -> sched_id;
pub fn rust_new_task_in_sched(id: sched_id) -> task_id;
pub fn start_task(id: task_id, f: closure);
}
}
pub fn main() {

View File

@ -8,13 +8,17 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
struct Quad { a: u64, b: u64, c: u64, d: u64 }
struct Floats { a: f64, b: u8, c: f64 }
pub struct Quad { a: u64, b: u64, c: u64, d: u64 }
pub struct Floats { a: f64, b: u8, c: f64 }
#[nolink]
extern mod rustrt {
pub fn debug_abi_1(++q: Quad) -> Quad;
pub fn debug_abi_2(++f: Floats) -> Floats;
mod rustrt {
use super::{Floats, Quad};
#[nolink]
pub extern {
pub fn debug_abi_1(++q: Quad) -> Quad;
pub fn debug_abi_2(++f: Floats) -> Floats;
}
}
fn test1() {

View File

@ -12,9 +12,11 @@
#[allow(ctypes)];
#[nolink]
extern mod libc {
pub fn malloc(size: int) -> *u8;
mod libc {
#[nolink]
pub extern {
pub fn malloc(size: int) -> *u8;
}
}
pub fn main() {

View File

@ -14,13 +14,15 @@ type SIZE_T = u32;
type LPVOID = uint;
type BOOL = u8;
#[cfg(target_os = "win32")]
#[abi = "stdcall"]
extern mod kernel32 {
pub fn GetProcessHeap() -> HANDLE;
pub fn HeapAlloc(hHeap: HANDLE, dwFlags: DWORD, dwBytes: SIZE_T)
-> LPVOID;
pub fn HeapFree(hHeap: HANDLE, dwFlags: DWORD, lpMem: LPVOID) -> BOOL;
mod kernel32 {
#[cfg(target_os = "win32")]
#[abi = "stdcall"]
pub extern {
pub fn GetProcessHeap() -> HANDLE;
pub fn HeapAlloc(hHeap: HANDLE, dwFlags: DWORD, dwBytes: SIZE_T)
-> LPVOID;
pub fn HeapFree(hHeap: HANDLE, dwFlags: DWORD, lpMem: LPVOID) -> BOOL;
}
}