From a23d7e10c7187ba2b0f2069a9905994592fa1108 Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Fri, 24 Apr 2015 20:07:01 +0300 Subject: [PATCH] Remove Managed Leftovers from @-pointer times. --- src/libcore/intrinsics.rs | 3 --- src/libcore/marker.rs | 10 -------- src/librustc/middle/lang_items.rs | 1 - src/librustc/middle/ty.rs | 23 +------------------ src/librustc_trans/trans/intrinsic.rs | 4 ---- src/librustc_typeck/check/mod.rs | 1 - ...typeck-default-trait-impl-negation-sync.rs | 7 ++++-- 7 files changed, 6 insertions(+), 43 deletions(-) diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index ac43055a7c4a5..101381e2c71ef 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -267,9 +267,6 @@ extern "rust-intrinsic" { /// `Copy`, then may return `true` or `false`. pub fn needs_drop() -> bool; - /// Returns `true` if a type is managed (will be allocated on the local heap) - pub fn owns_managed() -> bool; - /// Calculates the offset from a pointer. /// /// This is implemented as an intrinsic to avoid converting to and from an diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index e8c7045141d05..04839b12ac895 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -43,7 +43,6 @@ unsafe impl Send for .. { } impl !Send for *const T { } impl !Send for *mut T { } -impl !Send for Managed { } /// Types with a constant size known at compile-time. #[stable(feature = "rust1", since = "1.0.0")] @@ -212,7 +211,6 @@ unsafe impl Sync for .. { } impl !Sync for *const T { } impl !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 @@ -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 Hash for $t { diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index c77a43e75cdc0..c2865e3384967 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -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; diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 5f9e282bc53fe..c11a6003444a1 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -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, @@ -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 } @@ -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) } @@ -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 @@ -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 diff --git a/src/librustc_trans/trans/intrinsic.rs b/src/librustc_trans/trans/intrinsic.rs index 7188fdebeecf4..4b1bdd63dd732 100644 --- a/src/librustc_trans/trans/intrinsic.rs +++ b/src/librustc_trans/trans/intrinsic.rs @@ -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]; diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index cb5b569fd79cb..5168ca67e0729 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -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)), diff --git a/src/test/compile-fail/typeck-default-trait-impl-negation-sync.rs b/src/test/compile-fail/typeck-default-trait-impl-negation-sync.rs index d613589e7d777..7c5d1d93b1a7f 100644 --- a/src/test/compile-fail/typeck-default-trait-impl-negation-sync.rs +++ b/src/test/compile-fail/typeck-default-trait-impl-negation-sync.rs @@ -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 { @@ -46,5 +49,5 @@ fn main() { //~^ ERROR the trait `core::marker::Sync` is not implemented for the type `core::cell::UnsafeCell` is_sync::(); - //~^ 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` }