Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Managed #24778

Merged
merged 1 commit into from
May 1, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/libcore/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,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.
///
/// This is implemented as an intrinsic to avoid converting to and from an
Expand Down
10 changes: 0 additions & 10 deletions src/libcore/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,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 @@ -212,7 +211,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 @@ -223,14 +221,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 @@ -3490,12 +3490,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 @@ -3506,13 +3504,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 @@ -3527,10 +3518,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 @@ -3567,12 +3554,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 @@ -3817,9 +3798,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 @@ -387,10 +387,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 @@ -4945,7 +4945,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`
}