about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-04-30 20:26:12 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-05-07 08:13:24 -0700
commit2ad98fbb27edcc1170fde800219a107faac4ae44 (patch)
treef0eaa5daead69a8a5157f97d8c988679761c7cd3 /src/libstd
parentead6e16a600526b6125ad482d5e17e1f900730ce (diff)
downloadrust-2ad98fbb27edcc1170fde800219a107faac4ae44.tar.gz
rust-2ad98fbb27edcc1170fde800219a107faac4ae44.zip
core: Inherit the ty module
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/lib.rs3
-rw-r--r--src/libstd/ty.rs71
2 files changed, 1 insertions, 73 deletions
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index 0ef623a558f..eada05bf487 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -135,6 +135,7 @@ extern crate core;
 
 #[cfg(not(test))] pub use kinds = core::kinds;
 #[cfg(not(test))] pub use ops = core::ops;
+#[cfg(not(test))] pub use ty = core::ty;
 
 pub use core::cast;
 pub use core::intrinsics;
@@ -196,7 +197,6 @@ pub mod strbuf;
 
 pub mod ascii;
 
-pub mod owned;
 mod managed;
 mod reference;
 pub mod rc;
@@ -206,7 +206,6 @@ pub mod gc;
 /* Core language traits */
 
 #[cfg(not(test))] pub mod cmp;
-#[cfg(not(test))] pub mod ty;
 #[cfg(not(test))] pub mod owned;
 
 
diff --git a/src/libstd/ty.rs b/src/libstd/ty.rs
deleted file mode 100644
index 0c9f0b02fdf..00000000000
--- a/src/libstd/ty.rs
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright 2012-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 <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.
-
-//! Types dealing with unsafe actions.
-
-use cast;
-use kinds::marker;
-
-/// Unsafe type that wraps a type T and indicates unsafe interior operations on the
-/// wrapped type. Types with an `Unsafe<T>` field are considered to have an *unsafe
-/// interior*. The Unsafe type is the only legal way to obtain aliasable data that is
-/// considered mutable. In general, transmuting an &T type into an &mut T is considered
-/// undefined behavior.
-///
-/// Although it is possible to put an Unsafe<T> into static item, it is not permitted to
-/// take the address of the static item if the item is not declared as mutable. This rule
-/// exists because immutable static items are stored in read-only memory, and thus any
-/// attempt to mutate their interior can cause segfaults. Immutable static items containing
-/// Unsafe<T> instances are still useful as read-only initializers, however, so we do not
-/// forbid them altogether.
-///
-/// Types like `Cell` and `RefCell` use this type to wrap their internal data.
-///
-/// Unsafe doesn't opt-out from any kind, instead, types with an `Unsafe` interior
-/// are expected to opt-out from kinds themselves.
-///
-/// # Example:
-///
-/// ```rust
-/// use std::ty::Unsafe;
-/// use std::kinds::marker;
-///
-/// struct NotThreadSafe<T> {
-///     value: Unsafe<T>,
-///     marker1: marker::NoShare
-/// }
-/// ```
-///
-/// **NOTE:** Unsafe<T> fields are public to allow static initializers. It is not recommended
-/// to access its fields directly, `get` should be used instead.
-#[lang="unsafe"]
-pub struct Unsafe<T> {
-    /// Wrapped value
-    pub value: T,
-
-    /// Invariance marker
-    pub marker1: marker::InvariantType<T>
-}
-
-impl<T> Unsafe<T> {
-
-    /// Static constructor
-    pub fn new(value: T) -> Unsafe<T> {
-        Unsafe{value: value, marker1: marker::InvariantType}
-    }
-
-    /// Gets a mutable pointer to the wrapped value
-    #[inline]
-    pub unsafe fn get(&self) -> *mut T { cast::transmute_mut_unsafe(&self.value) }
-
-    /// Unwraps the value
-    #[inline]
-    pub unsafe fn unwrap(self) -> T { self.value }
-}