]> git.lizzy.rs Git - rust.git/commitdiff
Merge pull request #4443 from wting/4386_add_privs
authorTim Chevalier <chevalier@alum.wellesley.edu>
Sat, 12 Jan 2013 04:11:57 +0000 (20:11 -0800)
committerTim Chevalier <chevalier@alum.wellesley.edu>
Sat, 12 Jan 2013 04:11:57 +0000 (20:11 -0800)
Adds priv qualifiers where they have been commented out before implementation.

18 files changed:
configure
src/libcore/core.rc
src/libcore/ops.rs
src/libcore/prelude.rs
src/libcore/private.rs
src/librustc/front/test.rs
src/librustc/middle/lang_items.rs
src/librustc/middle/resolve.rs
src/libstd/c_vec.rs
src/libstd/net_tcp.rs
src/libstd/net_url.rs
src/libstd/uv_ll.rs
src/libsyntax/ast_util.rs
src/libsyntax/ext/expand.rs
src/rt/rust_builtin.cpp
src/rt/rustrt.def.in
src/test/run-pass/issue_3882.rs
src/test/run-pass/operator-overloading.rs

index 1e1b725ff47e9ac23147e9fd33aef9c7c7fc1af5..acf27a218a631921e15d8a7738e63c20215f8ea5 100755 (executable)
--- a/configure
+++ b/configure
@@ -516,7 +516,7 @@ then
                       | cut -d ' ' -f 2)
 
     case $CFG_CLANG_VERSION in
-        (3.0svn | 3.0 | 3.1 | 4.0 | 4.1)
+        (3.0svn | 3.0 | 3.1 | 3.2 | 4.0 | 4.1)
         step_msg "found ok version of CLANG: $CFG_CLANG_VERSION"
         CFG_C_COMPILER="clang"
         ;;
index f8658b8e46e164c10db29d9e68262528e185cc1c..81b9077fb3e0fcc56bec3fe3d4592787aa685130 100644 (file)
@@ -172,7 +172,7 @@ pub mod util;
 
 pub use kinds::{Const, Copy, Owned, Durable};
 pub use ops::{Drop};
-pub use ops::{Add, Sub, Mul, Div, Modulo, Neg};
+pub use ops::{Add, Sub, Mul, Div, Modulo, Neg, Not};
 pub use ops::{BitAnd, BitOr, BitXor};
 pub use ops::{Shl, Shr, Index};
 
index 22c363ba9c053a9399386cddce0f29ddacfe16e0..36293d6a1c0cef105a7bf00683b2870e935192c0 100644 (file)
@@ -48,6 +48,11 @@ pub trait Neg<Result> {
     pure fn neg(&self) -> Result;
 }
 
+#[lang="not"]
+pub trait Not<Result> {
+    pure fn not(&self) -> Result;
+}
+
 #[lang="bitand"]
 pub trait BitAnd<RHS,Result> {
     pure fn bitand(&self, rhs: &RHS) -> Result;
@@ -77,4 +82,3 @@ pub trait Shr<RHS,Result> {
 pub trait Index<Index,Result> {
     pure fn index(&self, index: Index) -> Result;
 }
-
index f2f6659278d44a99089f78b6431484acfbe93fb9..de23feceea5907478230cd038cfb9cb026faeebc 100644 (file)
@@ -4,7 +4,7 @@
 
 pub use kinds::{Const, Copy, Owned, Durable};
 pub use ops::{Drop};
-pub use ops::{Add, Sub, Mul, Div, Modulo, Neg};
+pub use ops::{Add, Sub, Mul, Div, Modulo, Neg, Not};
 pub use ops::{BitAnd, BitOr, BitXor};
 pub use ops::{Shl, Shr, Index};
 pub use option::{Option, Some, None};
index b9b6f10a185b772a59f560051dc35416ba44ef51..a88a11969359d20d16d63929444cfb3aafbc98cf 100644 (file)
@@ -37,6 +37,9 @@
     unsafe fn rust_destroy_little_lock(lock: rust_little_lock);
     unsafe fn rust_lock_little_lock(lock: rust_little_lock);
     unsafe fn rust_unlock_little_lock(lock: rust_little_lock);
+
+    unsafe fn rust_raw_thread_start(f: &fn()) -> *raw_thread;
+    unsafe fn rust_raw_thread_join_delete(thread: *raw_thread);
 }
 
 #[abi = "rust-intrinsic"]
     fn atomic_xsub(dst: &mut int, src: int) -> int;
 }
 
+#[allow(non_camel_case_types)] // runtime type
+type raw_thread = libc::c_void;
+
+/**
+
+Start a new thread outside of the current runtime context and wait
+for it to terminate.
+
+The executing thread has no access to a task pointer and will be using
+a normal large stack.
+*/
+pub unsafe fn run_in_bare_thread(f: ~fn()) {
+    let (port, chan) = pipes::stream();
+    // XXX Unfortunate that this creates an extra scheduler but it's necessary
+    // since rust_raw_thread_join_delete is blocking
+    do task::spawn_sched(task::SingleThreaded) unsafe {
+        let closure: &fn() = || {
+            f()
+        };
+        let thread = rustrt::rust_raw_thread_start(closure);
+        rustrt::rust_raw_thread_join_delete(thread);
+        chan.send(());
+    }
+    port.recv();
+}
+
+#[test]
+fn test_run_in_bare_thread() unsafe {
+    let i = 100;
+    do run_in_bare_thread {
+        assert i == 100;
+    }
+}
+
 #[allow(non_camel_case_types)] // runtime type
 type rust_port_id = uint;
 
index 81f748a3e602dfe0816fb8ccf0866a0947103a30..870a7d6c59377d2570a9ee7e668eb443090f04df 100644 (file)
@@ -364,10 +364,9 @@ fn mk_test_desc_rec(cx: test_ctxt, test: test) -> @ast::expr {
     debug!("encoding %s", ast_util::path_name_i(path,
                                                 cx.sess.parse_sess.interner));
 
-    // XXX: Bad copy of `path`.
     let name_lit: ast::lit =
         nospan(ast::lit_str(@ast_util::path_name_i(
-            copy path, cx.sess.parse_sess.interner)));
+            path, cx.sess.parse_sess.interner)));
     let name_expr_inner: @ast::expr =
         @{id: cx.sess.next_node_id(),
           callee_id: cx.sess.next_node_id(),
index 6870082ffacbaa4758d70050ce500fae47c9a4a0..ae56fb7f717dad13e1660738190be6284e74e141 100644 (file)
@@ -50,36 +50,37 @@ pub enum LangItem {
     DivTraitLangItem,           // 8
     ModuloTraitLangItem,        // 9
     NegTraitLangItem,           // 10
-    BitXorTraitLangItem,        // 11
-    BitAndTraitLangItem,        // 12
-    BitOrTraitLangItem,         // 13
-    ShlTraitLangItem,           // 14
-    ShrTraitLangItem,           // 15
-    IndexTraitLangItem,         // 16
-
-    EqTraitLangItem,            // 17
-    OrdTraitLangItem,           // 18
-
-    StrEqFnLangItem,            // 19
-    UniqStrEqFnLangItem,        // 20
-    AnnihilateFnLangItem,       // 21
-    LogTypeFnLangItem,          // 22
-    FailFnLangItem,             // 23
-    FailBoundsCheckFnLangItem,  // 24
-    ExchangeMallocFnLangItem,   // 25
-    ExchangeFreeFnLangItem,     // 26
-    MallocFnLangItem,           // 27
-    FreeFnLangItem,             // 28
+    NotTraitLangItem,           // 11
+    BitXorTraitLangItem,        // 12
+    BitAndTraitLangItem,        // 13
+    BitOrTraitLangItem,         // 14
+    ShlTraitLangItem,           // 15
+    ShrTraitLangItem,           // 16
+    IndexTraitLangItem,         // 17
+
+    EqTraitLangItem,            // 18
+    OrdTraitLangItem,           // 19
+
+    StrEqFnLangItem,            // 20
+    UniqStrEqFnLangItem,        // 21
+    AnnihilateFnLangItem,       // 22
+    LogTypeFnLangItem,          // 23
+    FailFnLangItem,             // 24
+    FailBoundsCheckFnLangItem,  // 25
+    ExchangeMallocFnLangItem,   // 26
+    ExchangeFreeFnLangItem,     // 27
+    MallocFnLangItem,           // 28
+    FreeFnLangItem,             // 29
 }
 
 struct LanguageItems {
-    items: [ Option<def_id> * 29 ]
+    items: [ Option<def_id> * 30 ]
 }
 
 impl LanguageItems {
     static pub fn new() -> LanguageItems {
         LanguageItems {
-            items: [ None, ..29 ]
+            items: [ None, ..30 ]
         }
     }
 
@@ -106,25 +107,26 @@ fn each_item(&self, f: &fn(def_id: def_id, i: uint) -> bool) {
             8  => "div",
             9  => "modulo",
             10 => "neg",
-            11 => "bitxor",
-            12 => "bitand",
-            13 => "bitor",
-            14 => "shl",
-            15 => "shr",
-            16 => "index",
-            17 => "eq",
-            18 => "ord",
-
-            19 => "str_eq",
-            20 => "uniq_str_eq",
-            21 => "annihilate",
-            22 => "log_type",
-            23 => "fail_",
-            24 => "fail_bounds_check",
-            25 => "exchange_malloc",
-            26 => "exchange_free",
-            27 => "malloc",
-            28 => "free",
+            11 => "not",
+            12 => "bitxor",
+            13 => "bitand",
+            14 => "bitor",
+            15 => "shl",
+            16 => "shr",
+            17 => "index",
+            18 => "eq",
+            19 => "ord",
+
+            20 => "str_eq",
+            21 => "uniq_str_eq",
+            22 => "annihilate",
+            23 => "log_type",
+            24 => "fail_",
+            25 => "fail_bounds_check",
+            26 => "exchange_malloc",
+            27 => "exchange_free",
+            28 => "malloc",
+            29 => "free",
 
             _ => "???"
         }
@@ -167,6 +169,9 @@ pub fn modulo_trait(&const self) -> def_id {
     pub fn neg_trait(&const self) -> def_id {
         self.items[NegTraitLangItem as uint].get()
     }
+    pub fn not_trait(&const self) -> def_id {
+        self.items[NotTraitLangItem as uint].get()
+    }
     pub fn bitxor_trait(&const self) -> def_id {
         self.items[BitXorTraitLangItem as uint].get()
     }
@@ -244,6 +249,7 @@ fn LanguageItemCollector(crate: @crate,
     item_refs.insert(~"div", DivTraitLangItem as uint);
     item_refs.insert(~"modulo", ModuloTraitLangItem as uint);
     item_refs.insert(~"neg", NegTraitLangItem as uint);
+    item_refs.insert(~"not", NotTraitLangItem as uint);
     item_refs.insert(~"bitxor", BitXorTraitLangItem as uint);
     item_refs.insert(~"bitand", BitAndTraitLangItem as uint);
     item_refs.insert(~"bitor", BitOrTraitLangItem as uint);
index e2a5c7ca9f96f2d4e5f362beed9bd501143cf634..a7c579127f95478d9d3e165c72a3199470dff681 100644 (file)
@@ -54,7 +54,7 @@
 use syntax::ast::{type_value_ns, ty_param_bound, unnamed_field};
 use syntax::ast::{variant, view_item, view_item_export, view_item_import};
 use syntax::ast::{view_item_use, view_path_glob, view_path_list};
-use syntax::ast::{view_path_simple, visibility, anonymous, named};
+use syntax::ast::{view_path_simple, visibility, anonymous, named, not};
 use syntax::ast_util::{def_id_of_def, dummy_sp, local_def};
 use syntax::ast_util::{path_to_ident, walk_pat, trait_method_to_ty_method};
 use syntax::ast_util::{Privacy, Public, Private, visibility_to_privacy};
@@ -5217,6 +5217,10 @@ fn record_candidate_traits_for_expr_if_necessary(expr: @expr) {
                 self.add_fixed_trait_for_expr(expr.id,
                                               self.lang_items.neg_trait());
             }
+            expr_unary(not, _) => {
+                self.add_fixed_trait_for_expr(expr.id,
+                                              self.lang_items.not_trait());
+            }
             expr_index(*) => {
                 self.add_fixed_trait_for_expr(expr.id,
                                               self.lang_items.index_trait());
index fe1bfa62fb1a9dc3910033381c571b438126b8f4..359d3039229e606b5e1bbee7c2348e0c12770183 100644 (file)
@@ -161,12 +161,14 @@ mod tests {
     use core::libc;
 
     fn malloc(n: size_t) -> CVec<u8> {
-        let mem = libc::malloc(n);
+        unsafe {
+            let mem = libc::malloc(n);
 
-        assert mem as int != 0;
+            assert mem as int != 0;
 
-        return unsafe { c_vec_with_dtor(mem as *mut u8, n as uint,
-                                     ||free(mem)) };
+            return unsafe { c_vec_with_dtor(mem as *mut u8, n as uint,
+                                         || unsafe { free(mem) }) };
+        }
     }
 
     #[test]
index 1177ca4d69d575e6c4e5ce2169909b5aa211e248..f7a3cd3833bbeb8aedc96ed9608b679c855f7dee 100644 (file)
@@ -1317,7 +1317,9 @@ fn test_gl_tcp_server_address_in_use() unsafe {
             fn test_gl_tcp_server_access_denied() unsafe {
                 impl_gl_tcp_ipv4_server_access_denied();
             }
+            // Strange failure on Windows. --pcwalton
             #[test]
+            #[ignore(cfg(target_os = "windows"))]
             fn test_gl_tcp_ipv4_server_client_reader_writer() {
                 impl_gl_tcp_ipv4_server_client_reader_writer();
             }
@@ -1358,6 +1360,7 @@ fn test_gl_tcp_server_access_denied() unsafe {
             }
             #[test]
             #[ignore(cfg(target_os = "linux"))]
+            #[ignore(cfg(target_os = "windows"))]
             fn test_gl_tcp_ipv4_server_client_reader_writer() {
                 impl_gl_tcp_ipv4_server_client_reader_writer();
             }
index 25a7895280790e6c5370d829ff8c9651f982e871..1992e38e7fac3965fb42fe272bf967e26a8ec088 100644 (file)
@@ -1077,6 +1077,9 @@ fn test_encode_form_urlencoded() {
 
     #[test]
     fn test_decode_form_urlencoded() {
+        // FIXME #4449: Commented out because this causes an ICE, but only
+        // on FreeBSD
+        /*
         assert decode_form_urlencoded(~[]).len() == 0;
 
         let s = str::to_bytes("a=1&foo+bar=abc&foo+bar=12+%3D+34");
@@ -1084,5 +1087,6 @@ fn test_decode_form_urlencoded() {
         assert form.len() == 2;
         assert form.get_ref(&~"a") == &~[~"1"];
         assert form.get_ref(&~"foo bar") == &~[~"abc", ~"12 = 34"];
+        */
     }
 }
index c9ff5e3796b178af51950a3f58f56877be91b28e..778daf131c4b0e78f6a14c9df19adbc0419ae285 100644 (file)
@@ -1594,125 +1594,148 @@ pub fn test_uv_ll_tcp_server_and_request() unsafe {
     // struct size tests
     #[test]
     fn test_uv_ll_struct_size_uv_tcp_t() {
-        let foreign_handle_size =
-            ::uv_ll::rustrt::rust_uv_helper_uv_tcp_t_size();
-        let rust_handle_size = sys::size_of::<uv_tcp_t>();
-        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;
+        unsafe {
+            let foreign_handle_size =
+                ::uv_ll::rustrt::rust_uv_helper_uv_tcp_t_size();
+            let rust_handle_size = sys::size_of::<uv_tcp_t>();
+            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;
+        }
     }
     #[test]
     fn test_uv_ll_struct_size_uv_connect_t() {
-        let foreign_handle_size =
-            ::uv_ll::rustrt::rust_uv_helper_uv_connect_t_size();
-        let rust_handle_size = sys::size_of::<uv_connect_t>();
-        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;
+        unsafe {
+            let foreign_handle_size =
+                ::uv_ll::rustrt::rust_uv_helper_uv_connect_t_size();
+            let rust_handle_size = sys::size_of::<uv_connect_t>();
+            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;
+        }
     }
     #[test]
     fn test_uv_ll_struct_size_uv_buf_t() {
-        let foreign_handle_size =
-            ::uv_ll::rustrt::rust_uv_helper_uv_buf_t_size();
-        let rust_handle_size = sys::size_of::<uv_buf_t>();
-        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;
+        unsafe {
+            let foreign_handle_size =
+                ::uv_ll::rustrt::rust_uv_helper_uv_buf_t_size();
+            let rust_handle_size = sys::size_of::<uv_buf_t>();
+            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;
+        }
     }
     #[test]
     fn test_uv_ll_struct_size_uv_write_t() {
-        let foreign_handle_size =
-            ::uv_ll::rustrt::rust_uv_helper_uv_write_t_size();
-        let rust_handle_size = sys::size_of::<uv_write_t>();
-        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;
+        unsafe {
+            let foreign_handle_size =
+                ::uv_ll::rustrt::rust_uv_helper_uv_write_t_size();
+            let rust_handle_size = sys::size_of::<uv_write_t>();
+            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;
+        }
     }
 
     #[test]
     fn test_uv_ll_struct_size_sockaddr_in() {
-        let foreign_handle_size =
-            ::uv_ll::rustrt::rust_uv_helper_sockaddr_in_size();
-        let rust_handle_size = sys::size_of::<sockaddr_in>();
-        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;
+        unsafe {
+            let foreign_handle_size =
+                ::uv_ll::rustrt::rust_uv_helper_sockaddr_in_size();
+            let rust_handle_size = sys::size_of::<sockaddr_in>();
+            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;
+        }
     }
     #[test]
     fn test_uv_ll_struct_size_sockaddr_in6() {
-        let foreign_handle_size =
-            ::uv_ll::rustrt::rust_uv_helper_sockaddr_in6_size();
-        let rust_handle_size = sys::size_of::<sockaddr_in6>();
-        let output = fmt!("sockaddr_in6 -- foreign: %u rust: %u",
-                          foreign_handle_size as uint, rust_handle_size);
-        log(debug, output);
-        // FIXME #1645 .. rust appears to pad structs to the nearest byte..?
-        // .. can't get the uv::ll::sockaddr_in6 to == 28 :/
-        // .. so the type always appears to be 32 in size.. which is
-        // good, i guess.. better too big than too little
-        assert (4u+foreign_handle_size as uint) == rust_handle_size;
+        unsafe {
+            let foreign_handle_size =
+                ::uv_ll::rustrt::rust_uv_helper_sockaddr_in6_size();
+            let rust_handle_size = sys::size_of::<sockaddr_in6>();
+            let output = fmt!("sockaddr_in6 -- foreign: %u rust: %u",
+                              foreign_handle_size as uint, rust_handle_size);
+            log(debug, output);
+            // FIXME #1645 .. rust appears to pad structs to the nearest
+            // byte..?
+            // .. can't get the uv::ll::sockaddr_in6 to == 28 :/
+            // .. so the type always appears to be 32 in size.. which is
+            // good, i guess.. better too big than too little
+            assert (4u+foreign_handle_size as uint) == rust_handle_size;
+        }
     }
     #[test]
     #[ignore(reason = "questionable size calculations")]
     fn test_uv_ll_struct_size_addr_in() {
-        let foreign_handle_size =
-            ::uv_ll::rustrt::rust_uv_helper_addr_in_size();
-        let rust_handle_size = sys::size_of::<addr_in>();
-        let output = fmt!("addr_in -- foreign: %u rust: %u",
-                          foreign_handle_size as uint, rust_handle_size);
-        log(debug, output);
-        // FIXME #1645 .. see note above about struct padding
-        assert (4u+foreign_handle_size as uint) == rust_handle_size;
+        unsafe {
+            let foreign_handle_size =
+                ::uv_ll::rustrt::rust_uv_helper_addr_in_size();
+            let rust_handle_size = sys::size_of::<addr_in>();
+            let output = fmt!("addr_in -- foreign: %u rust: %u",
+                              foreign_handle_size as uint, rust_handle_size);
+            log(debug, output);
+            // FIXME #1645 .. see note above about struct padding
+            assert (4u+foreign_handle_size as uint) == rust_handle_size;
+        }
     }
 
     #[test]
     fn test_uv_ll_struct_size_uv_async_t() {
-        let foreign_handle_size =
-            ::uv_ll::rustrt::rust_uv_helper_uv_async_t_size();
-        let rust_handle_size = sys::size_of::<uv_async_t>();
-        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;
+        unsafe {
+            let foreign_handle_size =
+                ::uv_ll::rustrt::rust_uv_helper_uv_async_t_size();
+            let rust_handle_size = sys::size_of::<uv_async_t>();
+            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;
+        }
     }
 
     #[test]
     fn test_uv_ll_struct_size_uv_timer_t() {
-        let foreign_handle_size =
-            ::uv_ll::rustrt::rust_uv_helper_uv_timer_t_size();
-        let rust_handle_size = sys::size_of::<uv_timer_t>();
-        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;
+        unsafe {
+            let foreign_handle_size =
+                ::uv_ll::rustrt::rust_uv_helper_uv_timer_t_size();
+            let rust_handle_size = sys::size_of::<uv_timer_t>();
+            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;
+        }
     }
 
     #[test]
     #[ignore(cfg(target_os = "win32"))]
     fn test_uv_ll_struct_size_uv_getaddrinfo_t() {
-        let foreign_handle_size =
-            ::uv_ll::rustrt::rust_uv_helper_uv_getaddrinfo_t_size();
-        let rust_handle_size = sys::size_of::<uv_getaddrinfo_t>();
-        let output = fmt!("uv_getaddrinfo_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;
+        unsafe {
+            let foreign_handle_size =
+                ::uv_ll::rustrt::rust_uv_helper_uv_getaddrinfo_t_size();
+            let rust_handle_size = sys::size_of::<uv_getaddrinfo_t>();
+            let output = fmt!("uv_getaddrinfo_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;
+        }
     }
     #[test]
     #[ignore(cfg(target_os = "macos"))]
     #[ignore(cfg(target_os = "win32"))]
     fn test_uv_ll_struct_size_addrinfo() {
-        let foreign_handle_size =
-            ::uv_ll::rustrt::rust_uv_helper_addrinfo_size();
-        let rust_handle_size = sys::size_of::<addrinfo>();
-        let output = fmt!("addrinfo -- foreign: %u rust: %u",
-                          foreign_handle_size as uint, rust_handle_size);
-        log(debug, output);
-        assert foreign_handle_size as uint == rust_handle_size;
+        unsafe {
+            let foreign_handle_size =
+                ::uv_ll::rustrt::rust_uv_helper_addrinfo_size();
+            let rust_handle_size = sys::size_of::<addrinfo>();
+            let output = fmt!("addrinfo -- foreign: %u rust: %u",
+                              foreign_handle_size as uint, rust_handle_size);
+            log(debug, output);
+            assert foreign_handle_size as uint == rust_handle_size;
+        }
     }
 }
index 1a34fe29a71440aefac2b409351d3b6b40c7c2dc..898c89ff2c8b2bff87483f6d1140885665ec4db1 100644 (file)
@@ -46,7 +46,7 @@
 
 
 
-pure fn path_name_i(idents: ~[ident], intr: @token::ident_interner) -> ~str {
+pure fn path_name_i(idents: &[ident], intr: @token::ident_interner) -> ~str {
     // FIXME: Bad copies (#2543 -- same for everything else that says "bad")
     str::connect(idents.map(|i| *intr.get(*i)), ~"::")
 }
index e3fb7a289c186684a43d714018ba5d782312b08b..11abec941e8cf622a807610cc9fec2e6e159e945 100644 (file)
@@ -307,7 +307,7 @@ fn key(_x: @::core::condition::Handler<$in,$out>) { }
 
                 pub const cond : ::core::condition::Condition<$in,$out> =
                     ::core::condition::Condition {
-                    name: stringify!(c),
+                    name: stringify!($c),
                     key: key
                 };
             }
index a3c7486fa3a8ccae8119b98fee833b9399135add..b16006e1f91a163d4c11fe9e822cb5d9f5a84064 100644 (file)
@@ -15,6 +15,7 @@
 #include "rust_util.h"
 #include "rust_scheduler.h"
 #include "sync/timer.h"
+#include "sync/rust_thread.h"
 #include "rust_abi.h"
 #include "rust_port.h"
 
@@ -972,6 +973,36 @@ rust_log_str(uint32_t level, const char *str, size_t size) {
     task->sched_loop->get_log().log(task, level, "%.*s", (int)size, str);
 }
 
+extern "C" CDECL void      record_sp_limit(void *limit);
+
+class raw_thread: public rust_thread {
+public:
+    fn_env_pair *fn;
+
+    raw_thread(fn_env_pair *fn) : fn(fn) { }
+
+    virtual void run() {
+        record_sp_limit(0);
+        fn->f(NULL, fn->env, NULL);
+    }
+};
+
+extern "C" raw_thread*
+rust_raw_thread_start(fn_env_pair *fn) {
+    assert(fn);
+    raw_thread *thread = new raw_thread(fn);
+    thread->start();
+    return thread;
+}
+
+extern "C" void
+rust_raw_thread_join_delete(raw_thread *thread) {
+    assert(thread);
+    thread->join();
+    delete thread;
+}
+
+
 //
 // Local Variables:
 // mode: C++
index 020008c38421c645fe328a2ce904bda40c509bd1..cce4e411e02c792639907f6ef0f75238e606047c 100644 (file)
@@ -208,3 +208,5 @@ linenoiseHistoryAdd
 linenoiseHistorySetMaxLen
 linenoiseHistorySave
 linenoiseHistoryLoad
+rust_raw_thread_start
+rust_raw_thread_join_delete
index 3f88772d864f81c6056098f1a8999f0f42f1d4e3..b56884622da94e71f52edf5c568893badd1ac277 100644 (file)
@@ -1,3 +1,5 @@
+// xfail-test
+
 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
index 6d0473a7d2c0acaaf66c9b659544034572611e25..13439c6e7e67a7e4a6fce9e60f94483d18939cd3 100644 (file)
@@ -34,6 +34,12 @@ impl Point : ops::Neg<Point> {
     }
 }
 
+impl Point : ops::Not<Point> {
+    pure fn not(&self) -> Point {
+        Point {x: !self.x, y: !self.y }
+    }
+}
+
 impl Point : ops::Index<bool,int> {
     pure fn index(&self, +x: bool) -> int {
         if x { self.x } else { self.y }
@@ -55,6 +61,11 @@ fn main() {
     assert -p == Point {x: -11, y: -22};
     assert p[true] == 11;
     assert p[false] == 22;
+
+    let q = !p;
+    assert q.x == !(p.x);
+    assert q.y == !(p.y);
+
     // Issue #1733
     fn~(_x: int){}(p[true]);
 }