diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 7d734469b1293..8a890d0293cd8 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 4cd99492ee458..141ed7a92067a 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) -> 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(a: @T, b: @T) -> bool { @@ -66,14 +59,3 @@ fn test() { assert!((!ptr_eq::(x, y))); assert!((!ptr_eq::(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 e00ee11829547..0000000000000 --- 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 or the MIT license -// , 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 7bb0fe5faa184..0000000000000 --- 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 or the MIT license -// , 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); -}