From d07cd175daa24e25ce287ae013e5b6691c39dc36 Mon Sep 17 00:00:00 2001 From: Eduard Burtescu Date: Wed, 1 Oct 2014 00:00:59 +0300 Subject: std: remove gc module. --- src/libstd/gc.rs | 156 ------------------------------------------------------ src/libstd/lib.rs | 4 -- 2 files changed, 160 deletions(-) delete mode 100644 src/libstd/gc.rs (limited to 'src/libstd') diff --git a/src/libstd/gc.rs b/src/libstd/gc.rs deleted file mode 100644 index ecef8e9ed90..00000000000 --- a/src/libstd/gc.rs +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright 2013 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. - -/*! Task-local garbage-collected boxes - -The `Gc` type provides shared ownership of an immutable value. Destruction is not deterministic, and -will occur some time between every `Gc` handle being gone and the end of the task. The garbage -collector is task-local so `Gc` is not sendable. - -*/ - -#![experimental] -#![allow(experimental)] - -use clone::Clone; -use cmp::{Ord, PartialOrd, Ordering, Eq, PartialEq}; -use default::Default; -use fmt; -use hash; -use kinds::marker; -use option::Option; -use ops::Deref; -use raw; - -/// Immutable garbage-collected pointer type -#[lang="gc"] -#[experimental = "Gc is currently based on reference-counting and will not collect cycles until \ - task annihilation. For now, cycles need to be broken manually by using `Rc` \ - with a non-owning `Weak` pointer. A tracing garbage collector is planned."] -pub struct Gc { - _ptr: *mut T, - marker: marker::NoSend, -} - -#[unstable] -impl Clone for Gc { - /// Clone the pointer only - #[inline] - fn clone(&self) -> Gc { *self } -} - -/// An value that represents the task-local managed heap. -/// -/// Use this like `let foo = box(GC) Bar::new(...);` -#[lang="managed_heap"] -#[cfg(not(test))] -pub static GC: () = (); - -impl PartialEq for Gc { - #[inline] - fn eq(&self, other: &Gc) -> bool { *(*self) == *(*other) } - #[inline] - fn ne(&self, other: &Gc) -> bool { *(*self) != *(*other) } -} -impl PartialOrd for Gc { - #[inline] - fn partial_cmp(&self, other: &Gc) -> Option { - (**self).partial_cmp(&**other) - } - #[inline] - fn lt(&self, other: &Gc) -> bool { *(*self) < *(*other) } - #[inline] - fn le(&self, other: &Gc) -> bool { *(*self) <= *(*other) } - #[inline] - fn ge(&self, other: &Gc) -> bool { *(*self) >= *(*other) } - #[inline] - fn gt(&self, other: &Gc) -> bool { *(*self) > *(*other) } -} -impl Ord for Gc { - #[inline] - fn cmp(&self, other: &Gc) -> Ordering { (**self).cmp(&**other) } -} -impl Eq for Gc {} - -impl Deref for Gc { - fn deref<'a>(&'a self) -> &'a T { &**self } -} - -impl Default for Gc { - fn default() -> Gc { - box(GC) Default::default() - } -} - -impl raw::Repr<*const raw::GcBox> for Gc {} - -impl + 'static> hash::Hash for Gc { - fn hash(&self, s: &mut S) { - (**self).hash(s) - } -} - -impl fmt::Show for Gc { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - (**self).fmt(f) - } -} - -#[cfg(test)] -mod tests { - use prelude::*; - use super::*; - use cell::RefCell; - - #[test] - fn test_managed_clone() { - let a = box(GC) 5i; - let b: Gc = a.clone(); - assert!(a == b); - } - - #[test] - fn test_clone() { - let x = Gc::new(RefCell::new(5)); - let y = x.clone(); - *x.borrow().borrow_mut() = 20; - assert_eq!(*y.borrow().borrow(), 20); - } - - #[test] - fn test_simple() { - let x = Gc::new(5); - assert_eq!(*x.borrow(), 5); - } - - #[test] - fn test_simple_clone() { - let x = Gc::new(5); - let y = x.clone(); - assert_eq!(*x.borrow(), 5); - assert_eq!(*y.borrow(), 5); - } - - #[test] - fn test_ptr_eq() { - let x = Gc::new(5); - let y = x.clone(); - let z = Gc::new(7); - assert!(x.ptr_eq(&x)); - assert!(x.ptr_eq(&y)); - assert!(!x.ptr_eq(&z)); - } - - #[test] - fn test_destructor() { - let x = Gc::new(box 5); - assert_eq!(**x.borrow(), 5); - } -} diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 82de55efad6..f6c37b6cfc3 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -137,7 +137,6 @@ extern crate rustrt; #[cfg(test)] pub use realstd::cmp; #[cfg(test)] pub use realstd::ty; #[cfg(test)] pub use realstd::boxed; -#[cfg(test)] pub use realstd::gc; // NB: These reexports are in the order they should be listed in rustdoc @@ -220,9 +219,6 @@ pub mod rand; pub mod ascii; -#[cfg(not(test))] -pub mod gc; - pub mod time; /* Common traits */ -- cgit 1.4.1-3-g733a5 From db55e70c977f9e2a70e62ea819755ef02009db8e Mon Sep 17 00:00:00 2001 From: Eduard Burtescu Date: Thu, 2 Oct 2014 00:19:55 +0300 Subject: syntax: mark the managed_boxes feature as Removed. --- src/libcollections/lib.rs | 2 +- src/libcore/lib.rs | 2 +- src/libdebug/lib.rs | 2 +- src/libfourcc/lib.rs | 2 +- src/libhexfloat/lib.rs | 2 +- src/libregex_macros/lib.rs | 2 +- src/librustdoc/lib.rs | 2 +- src/librustrt/lib.rs | 2 +- src/libserialize/lib.rs | 2 +- src/libstd/lib.rs | 2 +- src/libsyntax/feature_gate.rs | 2 +- src/test/auxiliary/issue_16723_multiple_items_syntax_ext.rs | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src/libstd') diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index 4d0aaf83907..b74324c85c0 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -20,7 +20,7 @@ html_playground_url = "http://play.rust-lang.org/")] #![allow(unknown_features)] -#![feature(macro_rules, managed_boxes, default_type_params, phase, globs)] +#![feature(macro_rules, default_type_params, phase, globs)] #![feature(unsafe_destructor, import_shadowing, slicing_syntax)] #![no_std] diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 4890dc2bb73..584d09c75c8 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -58,7 +58,7 @@ #![no_std] #![allow(unknown_features)] -#![feature(globs, intrinsics, lang_items, macro_rules, managed_boxes, phase)] +#![feature(globs, intrinsics, lang_items, macro_rules, phase)] #![feature(simd, unsafe_destructor, slicing_syntax)] #![deny(missing_doc)] diff --git a/src/libdebug/lib.rs b/src/libdebug/lib.rs index 6341a380563..21abfae8be9 100644 --- a/src/libdebug/lib.rs +++ b/src/libdebug/lib.rs @@ -25,7 +25,7 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/master/")] #![experimental] -#![feature(managed_boxes, macro_rules)] +#![feature(macro_rules)] #![allow(experimental)] pub mod fmt; diff --git a/src/libfourcc/lib.rs b/src/libfourcc/lib.rs index 3aa40058792..388373807d8 100644 --- a/src/libfourcc/lib.rs +++ b/src/libfourcc/lib.rs @@ -50,7 +50,7 @@ fn main() { html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/master/")] -#![feature(plugin_registrar, managed_boxes)] +#![feature(plugin_registrar)] extern crate syntax; extern crate rustc; diff --git a/src/libhexfloat/lib.rs b/src/libhexfloat/lib.rs index ae7a3e66dfd..2fcc3b9691a 100644 --- a/src/libhexfloat/lib.rs +++ b/src/libhexfloat/lib.rs @@ -46,7 +46,7 @@ fn main() { #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/master/")] -#![feature(plugin_registrar, managed_boxes)] +#![feature(plugin_registrar)] extern crate syntax; extern crate rustc; diff --git a/src/libregex_macros/lib.rs b/src/libregex_macros/lib.rs index 3535038b6a5..67018769fb3 100644 --- a/src/libregex_macros/lib.rs +++ b/src/libregex_macros/lib.rs @@ -19,7 +19,7 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/master/")] -#![feature(plugin_registrar, managed_boxes, quote)] +#![feature(plugin_registrar, quote)] extern crate regex; extern crate syntax; diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index b46d8727b69..77d63224fcd 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -16,7 +16,7 @@ #![crate_type = "rlib"] #![allow(unknown_features)] -#![feature(globs, struct_variant, managed_boxes, macro_rules, phase, slicing_syntax)] +#![feature(globs, struct_variant, macro_rules, phase, slicing_syntax)] extern crate arena; extern crate debug; diff --git a/src/librustrt/lib.rs b/src/librustrt/lib.rs index ad1eac41e4d..d3ea07291a4 100644 --- a/src/librustrt/lib.rs +++ b/src/librustrt/lib.rs @@ -17,7 +17,7 @@ html_root_url = "http://doc.rust-lang.org/master/")] #![allow(unknown_features)] -#![feature(macro_rules, phase, globs, thread_local, managed_boxes, asm)] +#![feature(macro_rules, phase, globs, thread_local, asm)] #![feature(linkage, lang_items, unsafe_destructor, default_type_params)] #![feature(import_shadowing, slicing_syntax)] #![no_std] diff --git a/src/libserialize/lib.rs b/src/libserialize/lib.rs index 8c2f3235322..6de8ca19844 100644 --- a/src/libserialize/lib.rs +++ b/src/libserialize/lib.rs @@ -24,7 +24,7 @@ Core encoding and decoding interfaces. html_root_url = "http://doc.rust-lang.org/master/", html_playground_url = "http://play.rust-lang.org/")] #![allow(unknown_features)] -#![feature(macro_rules, managed_boxes, default_type_params, phase, slicing_syntax)] +#![feature(macro_rules, default_type_params, phase, slicing_syntax)] // test harness access #[cfg(test)] diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index f6c37b6cfc3..19b4d430562 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -106,7 +106,7 @@ html_playground_url = "http://play.rust-lang.org/")] #![allow(unknown_features)] -#![feature(macro_rules, globs, managed_boxes, linkage)] +#![feature(macro_rules, globs, linkage)] #![feature(default_type_params, phase, lang_items, unsafe_destructor)] #![feature(import_shadowing, slicing_syntax)] diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 8565bebe269..7dcc039a83f 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -40,7 +40,7 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[ ("struct_variant", Active), ("once_fns", Active), ("asm", Active), - ("managed_boxes", Active), + ("managed_boxes", Removed), ("non_ascii_idents", Active), ("thread_local", Active), ("link_args", Active), diff --git a/src/test/auxiliary/issue_16723_multiple_items_syntax_ext.rs b/src/test/auxiliary/issue_16723_multiple_items_syntax_ext.rs index ee5bc55b3fd..bb57b4a98bb 100644 --- a/src/test/auxiliary/issue_16723_multiple_items_syntax_ext.rs +++ b/src/test/auxiliary/issue_16723_multiple_items_syntax_ext.rs @@ -11,7 +11,7 @@ // ignore-stage1 // force-host -#![feature(plugin_registrar, managed_boxes, quote)] +#![feature(plugin_registrar, quote)] #![crate_type = "dylib"] extern crate syntax; -- cgit 1.4.1-3-g733a5