From 80f92f5c5fedadd131842977c0b9b21806f3902f Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sun, 9 Mar 2014 23:20:05 -0700 Subject: std: Relax an assertion in oneshot selection The assertion was erroneously ensuring that there was no data on the port when the port had selection aborted on it. This assertion was written in error because it's possible for data to be waiting on a port, even after it was disconnected. When aborting selection, if we see that there's data on the port, then we return true that data is available on the port. Closes #12802 --- src/libstd/comm/oneshot.rs | 19 ++++++++++------- src/libstd/comm/select.rs | 52 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 7 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/comm/oneshot.rs b/src/libstd/comm/oneshot.rs index 9deccfeb875..0f78c1971bc 100644 --- a/src/libstd/comm/oneshot.rs +++ b/src/libstd/comm/oneshot.rs @@ -339,14 +339,19 @@ impl Packet { DATA => Ok(true), // If the other end has hung up, then we have complete ownership - // of the port. We need to check to see if there was an upgrade - // requested, and if so, the other end needs to have its selection - // aborted. + // of the port. First, check if there was data waiting for us. This + // is possible if the other end sent something and then hung up. + // + // We then need to check to see if there was an upgrade requested, + // and if so, the upgraded port needs to have its selection aborted. DISCONNECTED => { - assert!(self.data.is_none()); - match mem::replace(&mut self.upgrade, SendUsed) { - GoUp(port) => Err(port), - _ => Ok(true), + if self.data.is_some() { + Ok(true) + } else { + match mem::replace(&mut self.upgrade, SendUsed) { + GoUp(port) => Err(port), + _ => Ok(true), + } } } diff --git a/src/libstd/comm/select.rs b/src/libstd/comm/select.rs index 75e7265705a..3c6828fc14f 100644 --- a/src/libstd/comm/select.rs +++ b/src/libstd/comm/select.rs @@ -597,4 +597,56 @@ mod test { unsafe { h.add(); } assert_eq!(s.wait2(false), h.id); }) + + test!(fn oneshot_data_waiting() { + let (p, c) = Chan::new(); + let (p2, c2) = Chan::new(); + spawn(proc() { + select! { + () = p.recv() => {} + } + c2.send(()); + }); + + for _ in range(0, 100) { task::deschedule() } + c.send(()); + p2.recv(); + }) + + test!(fn stream_data_waiting() { + let (p, c) = Chan::new(); + let (p2, c2) = Chan::new(); + c.send(()); + c.send(()); + p.recv(); + p.recv(); + spawn(proc() { + select! { + () = p.recv() => {} + } + c2.send(()); + }); + + for _ in range(0, 100) { task::deschedule() } + c.send(()); + p2.recv(); + }) + + test!(fn shared_data_waiting() { + let (p, c) = Chan::new(); + let (p2, c2) = Chan::new(); + drop(c.clone()); + c.send(()); + p.recv(); + spawn(proc() { + select! { + () = p.recv() => {} + } + c2.send(()); + }); + + for _ in range(0, 100) { task::deschedule() } + c.send(()); + p2.recv(); + }) } -- cgit 1.4.1-3-g733a5 From 207ebf13f12d8fa4449d66cd86407de03f264667 Mon Sep 17 00:00:00 2001 From: Peter Marheine Date: Mon, 10 Mar 2014 19:30:23 -0400 Subject: doc: discuss try! in std::io --- src/libstd/io/mod.rs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/libstd') diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 7a18f24140a..1c10c7b61c3 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -172,6 +172,40 @@ need to inspect or unwrap the `IoResult` and we simply call `write_line` on it. If `new` returned an `Err(..)` then the followup call to `write_line` will also return an error. +## `try!` + +Explicit pattern matching on `IoResult`s can get quite verbose, especially +when performing many I/O operations. Some examples (like those above) are +alleviated with extra methods implemented on `IoResult`, but others have more +complex interdependencies among each I/O operation. + +The `try!` macro from `std::macros` is provided as a method of early-return +inside `Result`-returning functions. It expands to an early-return on `Err` +and otherwise unwraps the contained `Ok` value. + +If you wanted to read several `u32`s from a file and return their product: + +```rust +use std::io::{File, IoResult}; + +fn file_product(p: &Path) -> IoResult { + let mut f = File::open(p); + let x1 = try!(f.read_le_u32()); + let x2 = try!(f.read_le_u32()); + + Ok(x1 * x2) +} + +match file_product(&Path::new("numbers.bin")) { + Ok(x) => println!("{}", x), + Err(e) => println!("Failed to read numbers!") +} +``` + +With `try!` in `file_product`, each `read_le_u32` need not be directly +concerned with error handling; instead its caller is responsible for +responding to errors that may occur while attempting to read the numbers. + */ #[deny(unused_must_use)]; -- cgit 1.4.1-3-g733a5 From 9959188d0e653871b4995a25ce066dbf0726f132 Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Tue, 25 Feb 2014 08:03:41 -0800 Subject: Use generic impls for `Hash` --- src/libcollections/lru_cache.rs | 8 ++++---- src/libextra/lib.rs | 2 +- src/libextra/url.rs | 14 +++++++------- src/libstd/path/posix.rs | 8 ++++---- src/libstd/path/windows.rs | 8 ++++---- src/libstd/str.rs | 11 +++++++---- src/libuuid/lib.rs | 15 +++++++++++---- 7 files changed, 38 insertions(+), 28 deletions(-) (limited to 'src/libstd') diff --git a/src/libcollections/lru_cache.rs b/src/libcollections/lru_cache.rs index 0aace71813e..28ea36fa231 100644 --- a/src/libcollections/lru_cache.rs +++ b/src/libcollections/lru_cache.rs @@ -39,7 +39,7 @@ use std::cast; use std::container::Container; -use std::hash::{Hash, sip}; +use std::hash::Hash; use std::fmt; use std::ptr; @@ -62,9 +62,9 @@ pub struct LruCache { priv tail: *mut LruEntry, } -impl Hash for KeyRef { - fn hash(&self, s: &mut sip::SipState) { - unsafe {(*self.k).hash(s)} +impl> Hash for KeyRef { + fn hash(&self, state: &mut S) { + unsafe { (*self.k).hash(state) } } } diff --git a/src/libextra/lib.rs b/src/libextra/lib.rs index 673eb7e76de..32de7bf0866 100644 --- a/src/libextra/lib.rs +++ b/src/libextra/lib.rs @@ -29,7 +29,7 @@ Rust extras are part of the standard Rust distribution. html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://static.rust-lang.org/doc/master")]; -#[feature(macro_rules, globs, managed_boxes, asm)]; +#[feature(macro_rules, globs, managed_boxes, asm, default_type_params)]; #[deny(non_camel_case_types)]; #[deny(missing_doc)]; diff --git a/src/libextra/url.rs b/src/libextra/url.rs index 5812aaa5038..6be90c0056d 100644 --- a/src/libextra/url.rs +++ b/src/libextra/url.rs @@ -14,7 +14,7 @@ use std::cmp::Eq; use std::fmt; -use std::hash::{Hash, sip}; +use std::hash::Hash; use std::io::BufReader; use std::from_str::FromStr; use std::uint; @@ -849,15 +849,15 @@ impl fmt::Show for Path { } } -impl Hash for Url { - fn hash(&self, s: &mut sip::SipState) { - self.to_str().hash(s) +impl Hash for Url { + fn hash(&self, state: &mut S) { + self.to_str().hash(state) } } -impl Hash for Path { - fn hash(&self, s: &mut sip::SipState) { - self.to_str().hash(s) +impl Hash for Path { + fn hash(&self, state: &mut S) { + self.to_str().hash(state) } } diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs index a3380b5db1d..f7588f6ca59 100644 --- a/src/libstd/path/posix.rs +++ b/src/libstd/path/posix.rs @@ -15,7 +15,7 @@ use c_str::{CString, ToCStr}; use clone::Clone; use cmp::Eq; use from_str::FromStr; -use hash::{Hash, sip}; +use io::Writer; use iter::{AdditiveIterator, Extendable, Iterator, Map}; use option::{Option, None, Some}; use str; @@ -88,10 +88,10 @@ impl ToCStr for Path { } } -impl Hash for Path { +impl ::hash::Hash for Path { #[inline] - fn hash(&self, s: &mut sip::SipState) { - self.repr.hash(s) + fn hash(&self, hasher: &mut H) { + self.repr.hash(hasher) } } diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index 5b358819e41..6d05001beab 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -17,7 +17,7 @@ use clone::Clone; use container::Container; use cmp::Eq; use from_str::FromStr; -use hash::{Hash, sip}; +use io::Writer; use iter::{AdditiveIterator, DoubleEndedIterator, Extendable, Rev, Iterator, Map}; use option::{Option, Some, None}; use str; @@ -112,10 +112,10 @@ impl ToCStr for Path { } } -impl Hash for Path { +impl ::hash::Hash for Path { #[inline] - fn hash(&self, s: &mut sip::SipState) { - self.repr.hash(s) + fn hash(&self, hasher: &mut H) { + self.repr.hash(hasher) } } diff --git a/src/libstd/str.rs b/src/libstd/str.rs index 5bd14e717b1..1900d0ffedd 100644 --- a/src/libstd/str.rs +++ b/src/libstd/str.rs @@ -89,7 +89,7 @@ use clone::Clone; use cmp::{Eq, TotalEq, Ord, TotalOrd, Equiv, Ordering}; use container::{Container, Mutable}; use fmt; -use hash::{Hash, sip}; +use io::Writer; use iter::{Iterator, FromIterator, Extendable, range}; use iter::{Filter, AdditiveIterator, Map}; use iter::{Rev, DoubleEndedIterator, ExactSize}; @@ -1331,10 +1331,13 @@ impl<'a> Default for MaybeOwned<'a> { fn default() -> MaybeOwned<'a> { Slice("") } } -impl<'a> Hash for MaybeOwned<'a> { +impl<'a, H: Writer> ::hash::Hash for MaybeOwned<'a> { #[inline] - fn hash(&self, s: &mut sip::SipState) { - self.as_slice().hash(s) + fn hash(&self, hasher: &mut H) { + match *self { + Slice(s) => s.hash(hasher), + Owned(ref s) => s.hash(hasher), + } } } diff --git a/src/libuuid/lib.rs b/src/libuuid/lib.rs index aa17cd46809..922393d8bb3 100644 --- a/src/libuuid/lib.rs +++ b/src/libuuid/lib.rs @@ -59,6 +59,12 @@ Examples of string representations: #[crate_type = "dylib"]; #[license = "MIT/ASL2"]; +#[feature(default_type_params)]; + +// NOTE remove the following two attributes after the next snapshot. +#[allow(unrecognized_lint)]; +#[allow(default_type_param_usage)]; + // test harness access #[cfg(test)] extern crate test; @@ -71,7 +77,7 @@ use std::char::Char; use std::default::Default; use std::fmt; use std::from_str::FromStr; -use std::hash::{Hash, sip}; +use std::hash::Hash; use std::num::FromStrRadix; use std::str; use std::vec; @@ -116,9 +122,10 @@ pub struct Uuid { /// The 128-bit number stored in 16 bytes bytes: UuidBytes } -impl Hash for Uuid { - fn hash(&self, s: &mut sip::SipState) { - self.bytes.slice_from(0).hash(s) + +impl Hash for Uuid { + fn hash(&self, state: &mut S) { + self.bytes.hash(state) } } -- cgit 1.4.1-3-g733a5 From aac6e317639140a149d97116d43e66b5bd76bce3 Mon Sep 17 00:00:00 2001 From: lpy Date: Tue, 11 Mar 2014 21:39:26 +0800 Subject: Remove remaining nolink usages.(fixes #12810) --- src/doc/rust.md | 1 - src/libnative/io/file_win32.rs | 1 - src/librustc/middle/lint.rs | 2 +- src/libstd/io/test.rs | 1 - src/libstd/libc.rs | 23 ----------------------- src/libstd/os.rs | 4 ---- src/test/compile-fail/attrs-after-extern-mod.rs | 1 - src/test/compile-fail/lint-ctypes.rs | 1 - src/test/compile-fail/nolink-with-link-args.rs | 1 - src/test/run-pass/c-stack-returning-int64.rs | 1 - src/test/run-pass/foreign-fn-linkname.rs | 1 - src/test/run-pass/foreign-mod-unused-const.rs | 1 - src/test/run-pass/foreign-struct.rs | 1 - src/test/run-pass/foreign2.rs | 4 ---- src/test/run-pass/nil-decl-in-foreign.rs | 1 - src/test/run-pass/warn-ctypes-inhibit.rs | 1 - 16 files changed, 1 insertion(+), 44 deletions(-) (limited to 'src/libstd') diff --git a/src/doc/rust.md b/src/doc/rust.md index d1cef9a0614..9e2b934d0ab 100644 --- a/src/doc/rust.md +++ b/src/doc/rust.md @@ -1472,7 +1472,6 @@ and are instead terminated by a semicolon. ~~~~ # use std::libc::{c_char, FILE}; -# #[nolink] extern { fn fopen(filename: *c_char, mode: *c_char) -> *FILE; diff --git a/src/libnative/io/file_win32.rs b/src/libnative/io/file_win32.rs index e880bd05cf7..8f4f9259ab7 100644 --- a/src/libnative/io/file_win32.rs +++ b/src/libnative/io/file_win32.rs @@ -335,7 +335,6 @@ pub fn readdir(p: &CString) -> IoResult<~[Path]> { }).map(|path| root.join(path)).collect() } - #[nolink] extern { fn rust_list_dir_wfd_size() -> libc::size_t; fn rust_list_dir_wfd_fp_buf(wfd: *libc::c_void) -> *u16; diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index 1351e87c7f6..3e3a94f7f0f 100644 --- a/src/librustc/middle/lint.rs +++ b/src/librustc/middle/lint.rs @@ -979,7 +979,7 @@ static other_attrs: &'static [&'static str] = &[ "macro_export", "must_use", //mod-level - "path", "link_name", "link_args", "nolink", "macro_escape", "no_implicit_prelude", + "path", "link_name", "link_args", "macro_escape", "no_implicit_prelude", // fn-level "test", "bench", "should_fail", "ignore", "inline", "lang", "main", "start", diff --git a/src/libstd/io/test.rs b/src/libstd/io/test.rs index d6f7f58f01c..73d52654ebf 100644 --- a/src/libstd/io/test.rs +++ b/src/libstd/io/test.rs @@ -150,7 +150,6 @@ mod darwin_fd_limit { rlim_cur: rlim_t, rlim_max: rlim_t } - #[nolink] extern { // name probably doesn't need to be mut, but the C function doesn't specify const fn sysctl(name: *mut libc::c_int, namelen: libc::c_uint, diff --git a/src/libstd/libc.rs b/src/libstd/libc.rs index afd524e9d7a..c602c2fc27f 100644 --- a/src/libstd/libc.rs +++ b/src/libstd/libc.rs @@ -3306,7 +3306,6 @@ pub mod funcs { // or anything. The same is not true of POSIX. pub mod c95 { - #[nolink] pub mod ctype { use libc::types::os::arch::c95::{c_char, c_int}; @@ -3327,7 +3326,6 @@ pub mod funcs { } } - #[nolink] pub mod stdio { use libc::types::common::c95::{FILE, c_void, fpos_t}; use libc::types::os::arch::c95::{c_char, c_int, c_long, size_t}; @@ -3383,7 +3381,6 @@ pub mod funcs { } } - #[nolink] pub mod stdlib { use libc::types::common::c95::c_void; use libc::types::os::arch::c95::{c_char, c_double, c_int}; @@ -3416,7 +3413,6 @@ pub mod funcs { } } - #[nolink] pub mod string { use libc::types::common::c95::c_void; use libc::types::os::arch::c95::{c_char, c_int, size_t}; @@ -3461,7 +3457,6 @@ pub mod funcs { #[cfg(target_os = "win32")] pub mod posix88 { - #[nolink] pub mod stat_ { use libc::types::os::common::posix01::{stat, utimbuf}; use libc::types::os::arch::c95::{c_int, c_char, wchar_t}; @@ -3486,7 +3481,6 @@ pub mod funcs { } } - #[nolink] pub mod stdio { use libc::types::common::c95::FILE; use libc::types::os::arch::c95::{c_int, c_char}; @@ -3503,7 +3497,6 @@ pub mod funcs { } } - #[nolink] pub mod fcntl { use libc::types::os::arch::c95::{c_int, c_char, wchar_t}; extern { @@ -3518,12 +3511,10 @@ pub mod funcs { } } - #[nolink] pub mod dirent { // Not supplied at all. } - #[nolink] pub mod unistd { use libc::types::common::c95::c_void; use libc::types::os::arch::c95::{c_int, c_uint, c_char, @@ -3590,7 +3581,6 @@ pub mod funcs { use libc::types::os::arch::posix01::stat; use libc::types::os::arch::posix88::mode_t; - #[nolink] extern { pub fn chmod(path: *c_char, mode: mode_t) -> c_int; pub fn fchmod(fd: c_int, mode: mode_t) -> c_int; @@ -3618,7 +3608,6 @@ pub mod funcs { } } - #[nolink] pub mod stdio { use libc::types::common::c95::FILE; use libc::types::os::arch::c95::{c_char, c_int}; @@ -3631,7 +3620,6 @@ pub mod funcs { } } - #[nolink] pub mod fcntl { use libc::types::os::arch::c95::{c_char, c_int}; use libc::types::os::arch::posix88::mode_t; @@ -3644,7 +3632,6 @@ pub mod funcs { } } - #[nolink] pub mod dirent { use libc::types::common::posix88::{DIR, dirent_t}; use libc::types::os::arch::c95::{c_char, c_int, c_long}; @@ -3678,7 +3665,6 @@ pub mod funcs { } } - #[nolink] pub mod unistd { use libc::types::common::c95::c_void; use libc::types::os::arch::c95::{c_char, c_int, c_long, c_uint}; @@ -3748,7 +3734,6 @@ pub mod funcs { } } - #[nolink] pub mod signal { use libc::types::os::arch::c95::{c_int}; use libc::types::os::arch::posix88::{pid_t}; @@ -3758,7 +3743,6 @@ pub mod funcs { } } - #[nolink] pub mod mman { use libc::types::common::c95::{c_void}; use libc::types::os::arch::c95::{size_t, c_int, c_char}; @@ -3796,7 +3780,6 @@ pub mod funcs { #[cfg(target_os = "macos")] #[cfg(target_os = "freebsd")] pub mod posix01 { - #[nolink] pub mod stat_ { use libc::types::os::arch::c95::{c_char, c_int}; use libc::types::os::arch::posix01::stat; @@ -3813,7 +3796,6 @@ pub mod funcs { } } - #[nolink] pub mod unistd { use libc::types::os::arch::c95::{c_char, c_int, size_t}; use libc::types::os::arch::posix88::{ssize_t, off_t}; @@ -3841,7 +3823,6 @@ pub mod funcs { } } - #[nolink] pub mod wait { use libc::types::os::arch::c95::{c_int}; use libc::types::os::arch::posix88::{pid_t}; @@ -3852,7 +3833,6 @@ pub mod funcs { } } - #[nolink] pub mod glob { use libc::types::os::arch::c95::{c_char, c_int}; use libc::types::os::common::posix01::{glob_t}; @@ -3867,7 +3847,6 @@ pub mod funcs { } } - #[nolink] pub mod mman { use libc::types::common::c95::{c_void}; use libc::types::os::arch::c95::{c_int, size_t}; @@ -4032,7 +4011,6 @@ pub mod funcs { } #[cfg(target_os = "macos")] - #[nolink] pub mod extra { use libc::types::os::arch::c95::{c_char, c_int}; @@ -4256,7 +4234,6 @@ pub mod funcs { use libc::types::os::arch::c95::{c_int, c_long}; use libc::types::os::arch::c99::intptr_t; - #[nolink] extern { #[link_name = "_commit"] pub fn commit(fd: c_int) -> c_int; diff --git a/src/libstd/os.rs b/src/libstd/os.rs index e529daaa500..3a86aa3d6b6 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -615,7 +615,6 @@ pub fn errno() -> int { #[cfg(target_os = "macos")] #[cfg(target_os = "freebsd")] fn errno_location() -> *c_int { - #[nolink] extern { fn __error() -> *c_int; } @@ -627,7 +626,6 @@ pub fn errno() -> int { #[cfg(target_os = "linux")] #[cfg(target_os = "android")] fn errno_location() -> *c_int { - #[nolink] extern { fn __errno_location() -> *c_int; } @@ -665,7 +663,6 @@ pub fn last_os_error() -> ~str { #[cfg(target_os = "freebsd")] fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: libc::size_t) -> c_int { - #[nolink] extern { fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: libc::size_t) -> c_int; @@ -681,7 +678,6 @@ pub fn last_os_error() -> ~str { #[cfg(target_os = "linux")] fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: libc::size_t) -> c_int { - #[nolink] extern { fn __xpg_strerror_r(errnum: c_int, buf: *mut c_char, diff --git a/src/test/compile-fail/attrs-after-extern-mod.rs b/src/test/compile-fail/attrs-after-extern-mod.rs index 3102fb2664f..44b6ecdee70 100644 --- a/src/test/compile-fail/attrs-after-extern-mod.rs +++ b/src/test/compile-fail/attrs-after-extern-mod.rs @@ -14,7 +14,6 @@ use std::libc; -#[nolink] extern { static mut rust_dbg_static_mut: libc::c_int; pub fn rust_dbg_static_mut_check_four(); diff --git a/src/test/compile-fail/lint-ctypes.rs b/src/test/compile-fail/lint-ctypes.rs index a0c027b2d6b..0a1b78c8d5d 100644 --- a/src/test/compile-fail/lint-ctypes.rs +++ b/src/test/compile-fail/lint-ctypes.rs @@ -12,7 +12,6 @@ use std::libc; -#[nolink] extern { pub fn bare_type1(size: int); //~ ERROR: found rust type pub fn bare_type2(size: uint); //~ ERROR: found rust type diff --git a/src/test/compile-fail/nolink-with-link-args.rs b/src/test/compile-fail/nolink-with-link-args.rs index a1603ee9453..de929b8bfc9 100644 --- a/src/test/compile-fail/nolink-with-link-args.rs +++ b/src/test/compile-fail/nolink-with-link-args.rs @@ -17,7 +17,6 @@ the compiler output. */ #[feature(link_args)]; #[link_args = "aFdEfSeVEEE"] -#[nolink] extern {} fn main() { } diff --git a/src/test/run-pass/c-stack-returning-int64.rs b/src/test/run-pass/c-stack-returning-int64.rs index 940f62789bb..9a02768faeb 100644 --- a/src/test/run-pass/c-stack-returning-int64.rs +++ b/src/test/run-pass/c-stack-returning-int64.rs @@ -11,7 +11,6 @@ mod libc { use std::libc::{c_char, c_long, c_longlong}; - #[nolink] extern { pub fn atol(x: *c_char) -> c_long; pub fn atoll(x: *c_char) -> c_longlong; diff --git a/src/test/run-pass/foreign-fn-linkname.rs b/src/test/run-pass/foreign-fn-linkname.rs index b9d8d622731..7e480f1c32b 100644 --- a/src/test/run-pass/foreign-fn-linkname.rs +++ b/src/test/run-pass/foreign-fn-linkname.rs @@ -13,7 +13,6 @@ extern crate extra; mod libc { use std::libc::{c_char, size_t}; - #[nolink] extern { #[link_name = "strlen"] pub fn my_strlen(str: *c_char) -> size_t; diff --git a/src/test/run-pass/foreign-mod-unused-const.rs b/src/test/run-pass/foreign-mod-unused-const.rs index 977488d4529..2f587653941 100644 --- a/src/test/run-pass/foreign-mod-unused-const.rs +++ b/src/test/run-pass/foreign-mod-unused-const.rs @@ -11,7 +11,6 @@ mod foo { use std::libc::c_int; - #[nolink] extern { pub static errno: c_int; } diff --git a/src/test/run-pass/foreign-struct.rs b/src/test/run-pass/foreign-struct.rs index a70fec92659..e242071fb26 100644 --- a/src/test/run-pass/foreign-struct.rs +++ b/src/test/run-pass/foreign-struct.rs @@ -15,7 +15,6 @@ pub enum void { } mod bindgen { use super::void; - #[nolink] extern { pub fn printf(v: void); } diff --git a/src/test/run-pass/foreign2.rs b/src/test/run-pass/foreign2.rs index 350a3d6f4fc..7c9d2dfa87c 100644 --- a/src/test/run-pass/foreign2.rs +++ b/src/test/run-pass/foreign2.rs @@ -9,26 +9,22 @@ // except according to those terms. mod bar { - #[nolink] extern {} } mod zed { - #[nolink] extern {} } mod libc { use std::libc::{c_int, c_void, size_t, ssize_t}; - #[nolink] extern { pub fn write(fd: c_int, buf: *c_void, count: size_t) -> ssize_t; } } mod baz { - #[nolink] extern {} } diff --git a/src/test/run-pass/nil-decl-in-foreign.rs b/src/test/run-pass/nil-decl-in-foreign.rs index 15795f954b8..e23c970e29a 100644 --- a/src/test/run-pass/nil-decl-in-foreign.rs +++ b/src/test/run-pass/nil-decl-in-foreign.rs @@ -10,7 +10,6 @@ // Issue #901 mod libc { - #[nolink] extern { pub fn printf(x: ()); } diff --git a/src/test/run-pass/warn-ctypes-inhibit.rs b/src/test/run-pass/warn-ctypes-inhibit.rs index f2cc2d79a94..30ce7715311 100644 --- a/src/test/run-pass/warn-ctypes-inhibit.rs +++ b/src/test/run-pass/warn-ctypes-inhibit.rs @@ -13,7 +13,6 @@ #[allow(ctypes)]; mod libc { - #[nolink] extern { pub fn malloc(size: int) -> *u8; } -- cgit 1.4.1-3-g733a5