Skip to content

Commit

Permalink
Remove Managed
Browse files Browse the repository at this point in the history
Leftovers from @-pointer times.
  • Loading branch information
nagisa committed Apr 24, 2015
1 parent f191f92 commit be726a1
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 43 deletions.
3 changes: 0 additions & 3 deletions src/libcore/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,6 @@ extern "rust-intrinsic" {
/// `Copy`, then may return `true` or `false`.
pub fn needs_drop<T>() -> bool;

/// Returns `true` if a type is managed (will be allocated on the local heap)
pub fn owns_managed<T>() -> bool;

/// Calculates the offset from a pointer. The offset *must* be in-bounds of
/// the object, or one-byte-past-the-end. An arithmetic overflow is also
/// undefined behaviour.
Expand Down
10 changes: 0 additions & 10 deletions src/libcore/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ unsafe impl Send for .. { }

impl<T> !Send for *const T { }
impl<T> !Send for *mut T { }
impl !Send for Managed { }

/// Types with a constant size known at compile-time.
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down Expand Up @@ -243,7 +242,6 @@ unsafe impl Sync for .. { }

impl<T> !Sync for *const T { }
impl<T> !Sync for *mut T { }
impl !Sync for Managed { }

/// A type which is considered "not POD", meaning that it is not
/// implicitly copyable. This is typically embedded in other types to
Expand All @@ -254,14 +252,6 @@ impl !Sync for Managed { }
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
pub struct NoCopy;

/// A type which is considered managed by the GC. This is typically
/// embedded in other types.
#[unstable(feature = "core",
reason = "likely to change with new variance strategy")]
#[lang="managed_bound"]
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
pub struct Managed;

macro_rules! impls{
($t: ident) => (
impl<T:?Sized> Hash for $t<T> {
Expand Down
1 change: 0 additions & 1 deletion src/librustc/middle/lang_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,6 @@ lets_do_this! {
InvariantLifetimeItem, "invariant_lifetime", invariant_lifetime;

NoCopyItem, "no_copy_bound", no_copy_bound;
ManagedItem, "managed_bound", managed_bound;

NonZeroItem, "non_zero", non_zero;

Expand Down
23 changes: 1 addition & 22 deletions src/librustc/middle/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3414,12 +3414,10 @@ def_type_content_sets! {
// Things that are owned by the value (second and third nibbles):
OwnsOwned = 0b0000_0000__0000_0001__0000,
OwnsDtor = 0b0000_0000__0000_0010__0000,
OwnsManaged /* see [1] below */ = 0b0000_0000__0000_0100__0000,
OwnsAll = 0b0000_0000__1111_1111__0000,

// Things that are reachable by the value in any way (fourth nibble):
ReachesBorrowed = 0b0000_0010__0000_0000__0000,
// ReachesManaged /* see [1] below */ = 0b0000_0100__0000_0000__0000,
ReachesMutable = 0b0000_1000__0000_0000__0000,
ReachesFfiUnsafe = 0b0010_0000__0000_0000__0000,
ReachesAll = 0b0011_1111__0000_0000__0000,
Expand All @@ -3430,13 +3428,6 @@ def_type_content_sets! {
// Things that prevent values from being considered sized
Nonsized = 0b0000_0000__0000_0000__0001,

// Bits to set when a managed value is encountered
//
// [1] Do not set the bits TC::OwnsManaged or
// TC::ReachesManaged directly, instead reference
// TC::Managed to set them both at once.
Managed = 0b0000_0100__0000_0100__0000,

// All bits
All = 0b1111_1111__1111_1111__1111
}
Expand All @@ -3451,10 +3442,6 @@ impl TypeContents {
(self.bits & tc.bits) != 0
}

pub fn owns_managed(&self) -> bool {
self.intersects(TC::OwnsManaged)
}

pub fn owns_owned(&self) -> bool {
self.intersects(TC::OwnsOwned)
}
Expand Down Expand Up @@ -3491,12 +3478,6 @@ impl TypeContents {
*self & TC::ReachesAll)
}

/// Includes only those bits that still apply when indirected through a managed pointer (`@`)
pub fn managed_pointer(&self) -> TypeContents {
TC::Managed | (
*self & TC::ReachesAll)
}

/// Includes only those bits that still apply when indirected through an unsafe pointer (`*`)
pub fn unsafe_pointer(&self) -> TypeContents {
*self & TC::ReachesAll
Expand Down Expand Up @@ -3741,9 +3722,7 @@ pub fn type_contents<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> TypeContents {

fn apply_lang_items(cx: &ctxt, did: ast::DefId, tc: TypeContents)
-> TypeContents {
if Some(did) == cx.lang_items.managed_bound() {
tc | TC::Managed
} else if Some(did) == cx.lang_items.unsafe_cell_type() {
if Some(did) == cx.lang_items.unsafe_cell_type() {
tc | TC::InteriorUnsafe
} else {
tc
Expand Down
4 changes: 0 additions & 4 deletions src/librustc_trans/trans/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,6 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,

C_bool(ccx, bcx.fcx.type_needs_drop(tp_ty))
}
(_, "owns_managed") => {
let tp_ty = *substs.types.get(FnSpace, 0);
C_bool(ccx, ty::type_contents(ccx.tcx(), tp_ty).owns_managed())
}
(_, "offset") => {
let ptr = llargs[0];
let offset = llargs[1];
Expand Down
1 change: 0 additions & 1 deletion src/librustc_typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4846,7 +4846,6 @@ pub fn check_intrinsic_type(ccx: &CrateCtxt, it: &ast::ForeignItem) {
ty::mk_nil(tcx))
}
"needs_drop" => (1, Vec::new(), ccx.tcx.types.bool),
"owns_managed" => (1, Vec::new(), ccx.tcx.types.bool),

"type_name" => (1, Vec::new(), ty::mk_str_slice(tcx, tcx.mk_region(ty::ReStatic),
ast::MutImmutable)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@

#![feature(optin_builtin_traits)]

use std::marker::Managed;
struct Managed;
impl !Send for Managed {}
impl !Sync for Managed {}

use std::cell::UnsafeCell;

struct MySync {
Expand Down Expand Up @@ -46,5 +49,5 @@ fn main() {
//~^ ERROR the trait `core::marker::Sync` is not implemented for the type `core::cell::UnsafeCell<u8>`

is_sync::<MyTypeManaged>();
//~^ ERROR the trait `core::marker::Sync` is not implemented for the type `core::marker::Managed`
//~^ ERROR the trait `core::marker::Sync` is not implemented for the type `Managed`
}

0 comments on commit be726a1

Please sign in to comment.