about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2014-03-22 18:45:47 -0400
committerDaniel Micay <danielmicay@gmail.com>2014-03-22 22:33:16 -0400
commit31d5ffc5bde1d67356d1d0469fec34c6d06a32b5 (patch)
tree8a3b1e44b0e50bdac74970936d4e733805157566
parent7e7a5e3d3eabe0ee46474b0eb701c159a45b490f (diff)
downloadrust-31d5ffc5bde1d67356d1d0469fec34c6d06a32b5.tar.gz
rust-31d5ffc5bde1d67356d1d0469fec34c6d06a32b5.zip
make std::managed private
This removes two tests built on `managed::refcount`, but these issues
are well-covered elsewhere for non-managed types.
-rw-r--r--src/libstd/lib.rs2
-rw-r--r--src/libstd/managed.rs18
-rw-r--r--src/test/run-pass/match-pattern-drop.rs44
-rw-r--r--src/test/run-pass/unique-copy-box.rs24
4 files changed, 1 insertions, 87 deletions
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index 7d734469b12..8a890d0293c 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -134,7 +134,7 @@ pub mod ascii;
 
 pub mod ptr;
 pub mod owned;
-pub mod managed;
+mod managed;
 mod reference;
 pub mod rc;
 pub mod gc;
diff --git a/src/libstd/managed.rs b/src/libstd/managed.rs
index 4cd99492ee4..141ed7a9206 100644
--- a/src/libstd/managed.rs
+++ b/src/libstd/managed.rs
@@ -12,13 +12,6 @@
 
 #[cfg(not(test))] use cmp::*;
 
-/// Returns the refcount of a shared box (as just before calling this)
-#[inline]
-pub fn refcount<T>(t: @T) -> uint {
-    use raw::Repr;
-    unsafe { (*t.repr()).ref_count - 1 }
-}
-
 /// Determine if two shared boxes point to the same object
 #[inline]
 pub fn ptr_eq<T>(a: @T, b: @T) -> bool {
@@ -66,14 +59,3 @@ fn test() {
     assert!((!ptr_eq::<int>(x, y)));
     assert!((!ptr_eq::<int>(y, x)));
 }
-
-#[test]
-fn refcount_test() {
-    use clone::Clone;
-
-    let x = @3;
-    assert_eq!(refcount(x), 1);
-    let y = x.clone();
-    assert_eq!(refcount(x), 2);
-    assert_eq!(refcount(y), 2);
-}
diff --git a/src/test/run-pass/match-pattern-drop.rs b/src/test/run-pass/match-pattern-drop.rs
deleted file mode 100644
index e00ee118295..00000000000
--- a/src/test/run-pass/match-pattern-drop.rs
+++ /dev/null
@@ -1,44 +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 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[feature(managed_boxes)];
-
-enum t { make_t(@int), clam, }
-
-fn foo(s: @int) {
-    println!("{:?}", ::std::managed::refcount(s));
-    let count = ::std::managed::refcount(s);
-    let x: t = make_t(s); // ref up
-    assert_eq!(::std::managed::refcount(s), count + 1u);
-    println!("{:?}", ::std::managed::refcount(s));
-
-    match x {
-      make_t(y) => {
-        println!("{:?}", y); // ref up then down
-
-      }
-      _ => { println!("?"); fail!(); }
-    }
-    println!("{:?}", ::std::managed::refcount(s));
-    assert_eq!(::std::managed::refcount(s), count + 1u);
-    let _ = ::std::managed::refcount(s); // don't get bitten by last-use.
-}
-
-pub fn main() {
-    let s: @int = @0; // ref up
-
-    let count = ::std::managed::refcount(s);
-
-    foo(s); // ref up then down
-
-    println!("{}", ::std::managed::refcount(s));
-    let count2 = ::std::managed::refcount(s);
-    assert_eq!(count, count2);
-}
diff --git a/src/test/run-pass/unique-copy-box.rs b/src/test/run-pass/unique-copy-box.rs
deleted file mode 100644
index 7bb0fe5faa1..00000000000
--- a/src/test/run-pass/unique-copy-box.rs
+++ /dev/null
@@ -1,24 +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 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[feature(managed_boxes)];
-#[allow(unused_variable)];
-
-use std::managed;
-
-pub fn main() {
-    let i = ~@1;
-    let j = ~@2;
-    let rc1 = managed::refcount(*i);
-    let j = i.clone();
-    let rc2 = managed::refcount(*i);
-    println!("rc1: {} rc2: {}", rc1, rc2);
-    assert_eq!(rc1 + 1u, rc2);
-}