From c5229e5d2ea6168ec80a7feeea1a513b2b3176c0 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 30 Apr 2014 22:00:31 -0700 Subject: core: Inhert ~/@/& cmp traits, remove old modules This commit removes the std::{managed, reference} modules. The modules serve essentially no purpose, and the only free function removed was `managed::ptr_eq` which can be achieved by comparing references. [breaking-change] --- src/libstd/managed.rs | 58 --------------------------------------------------- 1 file changed, 58 deletions(-) delete mode 100644 src/libstd/managed.rs (limited to 'src/libstd/managed.rs') diff --git a/src/libstd/managed.rs b/src/libstd/managed.rs deleted file mode 100644 index bf73c05440c..00000000000 --- a/src/libstd/managed.rs +++ /dev/null @@ -1,58 +0,0 @@ -// 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. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Operations on managed box types - -#[cfg(not(test))] use cmp::*; - -/// Determine if two shared boxes point to the same object -#[inline] -pub fn ptr_eq(a: @T, b: @T) -> bool { - &*a as *T == &*b as *T -} - -#[cfg(not(test))] -impl Eq for @T { - #[inline] - fn eq(&self, other: &@T) -> bool { *(*self) == *(*other) } - #[inline] - fn ne(&self, other: &@T) -> bool { *(*self) != *(*other) } -} - -#[cfg(not(test))] -impl Ord for @T { - #[inline] - fn lt(&self, other: &@T) -> bool { *(*self) < *(*other) } - #[inline] - fn le(&self, other: &@T) -> bool { *(*self) <= *(*other) } - #[inline] - fn ge(&self, other: &@T) -> bool { *(*self) >= *(*other) } - #[inline] - fn gt(&self, other: &@T) -> bool { *(*self) > *(*other) } -} - -#[cfg(not(test))] -impl TotalOrd for @T { - #[inline] - fn cmp(&self, other: &@T) -> Ordering { (**self).cmp(*other) } -} - -#[cfg(not(test))] -impl TotalEq for @T {} - -#[test] -fn test() { - let x = @3; - let y = @3; - assert!((ptr_eq::(x, x))); - assert!((ptr_eq::(y, y))); - assert!((!ptr_eq::(x, y))); - assert!((!ptr_eq::(y, x))); -} -- cgit 1.4.1-3-g733a5