diff options
| author | Flavio Percoco <flaper87@gmail.com> | 2014-01-26 11:42:46 +0100 |
|---|---|---|
| committer | Flavio Percoco <flaper87@gmail.com> | 2014-02-04 00:15:27 +0100 |
| commit | c6b1bce96f25e785d22e976d1cc41cabdae5ea73 (patch) | |
| tree | 7becccf629cd6737546e49325a6a8c8a4fd61c50 /src/libstd/util.rs | |
| parent | d42521aa92006a3378c535adec80ae2257bff083 (diff) | |
| download | rust-c6b1bce96f25e785d22e976d1cc41cabdae5ea73.tar.gz rust-c6b1bce96f25e785d22e976d1cc41cabdae5ea73.zip | |
Replace NonCopyable usage with NoPod
cc #10834
Diffstat (limited to 'src/libstd/util.rs')
| -rw-r--r-- | src/libstd/util.rs | 38 |
1 files changed, 1 insertions, 37 deletions
diff --git a/src/libstd/util.rs b/src/libstd/util.rs index 06c7923bfed..c075f9b4ba8 100644 --- a/src/libstd/util.rs +++ b/src/libstd/util.rs @@ -12,7 +12,6 @@ use cast; use ptr; -use prelude::*; use unstable::intrinsics; /// The identity function. @@ -53,15 +52,6 @@ pub fn replace<T>(dest: &mut T, mut src: T) -> T { src } -/// A non-copyable dummy type. -#[deriving(Eq, TotalEq, Ord, TotalOrd)] -#[unsafe_no_drop_flag] -pub struct NonCopyable; - -impl Drop for NonCopyable { - fn drop(&mut self) { } -} - /// A type with no inhabitants pub enum Void { } @@ -101,37 +91,11 @@ mod tests { #[test] fn test_replace() { - let mut x = Some(NonCopyable); + let mut x = Some(~"test"); let y = replace(&mut x, None); assert!(x.is_none()); assert!(y.is_some()); } - - #[test] - fn test_noncopyable() { - assert_eq!(size_of::<NonCopyable>(), 0); - - // verify that `#[unsafe_no_drop_flag]` works as intended on a zero-size struct - - static mut did_run: bool = false; - - struct Foo { five: int } - - impl Drop for Foo { - fn drop(&mut self) { - assert_eq!(self.five, 5); - unsafe { - did_run = true; - } - } - } - - { - let _a = (NonCopyable, Foo { five: 5 }, NonCopyable); - } - - unsafe { assert_eq!(did_run, true); } - } } /// Completely miscellaneous language-construct benchmarks. |
