diff options
| author | bors <bors@rust-lang.org> | 2013-12-04 01:36:29 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-12-04 01:36:29 -0800 |
| commit | 9635c763ba5edc8c8ea2868b895548b52f640e5a (patch) | |
| tree | 95752f46f0ef6d8a85c6f9207a863eb5f4d362a6 /src/libstd | |
| parent | 63c9522c27647cd5f547a0622ce24026e230de33 (diff) | |
| parent | a243360401790476deea3d502f644783ed8d7563 (diff) | |
| download | rust-9635c763ba5edc8c8ea2868b895548b52f640e5a.tar.gz rust-9635c763ba5edc8c8ea2868b895548b52f640e5a.zip | |
auto merge of #10783 : sfackler/rust/drop, r=alexcrichton
It's a more fitting name for the most common use case of this function.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/io/fs.rs | 4 | ||||
| -rw-r--r-- | src/libstd/prelude.rs | 4 | ||||
| -rw-r--r-- | src/libstd/rt/sched.rs | 3 | ||||
| -rw-r--r-- | src/libstd/unstable/sync.rs | 7 | ||||
| -rw-r--r-- | src/libstd/util.rs | 4 |
5 files changed, 10 insertions, 12 deletions
diff --git a/src/libstd/io/fs.rs b/src/libstd/io/fs.rs index ee7d851679d..e239f630f01 100644 --- a/src/libstd/io/fs.rs +++ b/src/libstd/io/fs.rs @@ -1179,7 +1179,7 @@ mod test { file.write(bytes!("foo")); file.fsync(); file.datasync(); - util::ignore(file); + drop(file); }) test!(fn truncate_works() { @@ -1210,7 +1210,7 @@ mod test { assert_eq!(stat(&path).size, 9); assert_eq!(File::open(&path).read_to_end(), (bytes!("fo", 0, 0, 0, 0, "wut")).to_owned()); - util::ignore(file); + drop(file); }) test!(fn open_flavors() { diff --git a/src/libstd/prelude.rs b/src/libstd/prelude.rs index 60fe21bb8d2..83439d4c903 100644 --- a/src/libstd/prelude.rs +++ b/src/libstd/prelude.rs @@ -86,3 +86,7 @@ pub use vec::{Vector, VectorVector, CopyableVector, ImmutableVector}; // Reexported runtime types pub use comm::{stream, Port, Chan, GenericChan, GenericSmartChan, GenericPort, Peekable}; pub use task::spawn; + +/// Disposes of a value. +#[inline] +pub fn drop<T>(_x: T) { } diff --git a/src/libstd/rt/sched.rs b/src/libstd/rt/sched.rs index a231bea5e27..8c46a8eff39 100644 --- a/src/libstd/rt/sched.rs +++ b/src/libstd/rt/sched.rs @@ -1173,7 +1173,6 @@ mod test { use rt::sleeper_list::SleeperList; use rt::stack::StackPool; use rt::sched::{Shutdown, TaskFromFriend}; - use util; do run_in_bare_thread { stress_factor().times(|| { @@ -1205,7 +1204,7 @@ mod test { handle.send(TaskFromFriend(task)); handle.send(Shutdown); - util::ignore(handle); + drop(handle); thread.join(); }) diff --git a/src/libstd/unstable/sync.rs b/src/libstd/unstable/sync.rs index 420c1d69d1c..9df43dfc5d2 100644 --- a/src/libstd/unstable/sync.rs +++ b/src/libstd/unstable/sync.rs @@ -467,7 +467,6 @@ mod tests { use prelude::*; use super::{Exclusive, UnsafeArc, atomically}; use task; - use util; use mem::size_of; //#[unsafe_no_drop_flag] FIXME: #9758 @@ -571,7 +570,7 @@ mod tests { let x2 = x.clone(); let left_x = x.try_unwrap(); assert!(left_x.is_self()); - util::ignore(left_x); + drop(left_x); assert!(x2.try_unwrap().expect_t("try_unwrap none") == ~~"hello"); } @@ -590,7 +589,7 @@ mod tests { task::deschedule(); // Try to make the unwrapper get blocked first. let left_x = x.try_unwrap(); assert!(left_x.is_self()); - util::ignore(left_x); + drop(left_x); p.recv(); } @@ -620,7 +619,7 @@ mod tests { assert!(x2.unwrap() == ~~"hello"); } // Have to get rid of our reference before blocking. - util::ignore(x); + drop(x); res.recv(); } diff --git a/src/libstd/util.rs b/src/libstd/util.rs index d75c60c0bf2..85dac814add 100644 --- a/src/libstd/util.rs +++ b/src/libstd/util.rs @@ -19,10 +19,6 @@ use unstable::intrinsics; #[inline] pub fn id<T>(x: T) -> T { x } -/// Ignores a value. -#[inline] -pub fn ignore<T>(_x: T) { } - /** * Swap the values at two mutable locations of the same type, without * deinitialising or copying either one. |
