Remove Managed
Leftovers from @-pointer times.
This commit is contained in:
@@ -267,9 +267,6 @@ extern "rust-intrinsic" {
|
|||||||
/// `Copy`, then may return `true` or `false`.
|
/// `Copy`, then may return `true` or `false`.
|
||||||
pub fn needs_drop<T>() -> bool;
|
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.
|
/// Calculates the offset from a pointer.
|
||||||
///
|
///
|
||||||
/// This is implemented as an intrinsic to avoid converting to and from an
|
/// This is implemented as an intrinsic to avoid converting to and from an
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ unsafe impl Send for .. { }
|
|||||||
|
|
||||||
impl<T> !Send for *const T { }
|
impl<T> !Send for *const T { }
|
||||||
impl<T> !Send for *mut T { }
|
impl<T> !Send for *mut T { }
|
||||||
impl !Send for Managed { }
|
|
||||||
|
|
||||||
/// Types with a constant size known at compile-time.
|
/// Types with a constant size known at compile-time.
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
@@ -212,7 +211,6 @@ unsafe impl Sync for .. { }
|
|||||||
|
|
||||||
impl<T> !Sync for *const T { }
|
impl<T> !Sync for *const T { }
|
||||||
impl<T> !Sync for *mut T { }
|
impl<T> !Sync for *mut T { }
|
||||||
impl !Sync for Managed { }
|
|
||||||
|
|
||||||
/// A type which is considered "not POD", meaning that it is not
|
/// A type which is considered "not POD", meaning that it is not
|
||||||
/// implicitly copyable. This is typically embedded in other types to
|
/// implicitly copyable. This is typically embedded in other types to
|
||||||
@@ -223,14 +221,6 @@ impl !Sync for Managed { }
|
|||||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
|
||||||
pub struct NoCopy;
|
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{
|
macro_rules! impls{
|
||||||
($t: ident) => (
|
($t: ident) => (
|
||||||
impl<T:?Sized> Hash for $t<T> {
|
impl<T:?Sized> Hash for $t<T> {
|
||||||
|
|||||||
@@ -334,7 +334,6 @@ lets_do_this! {
|
|||||||
InvariantLifetimeItem, "invariant_lifetime", invariant_lifetime;
|
InvariantLifetimeItem, "invariant_lifetime", invariant_lifetime;
|
||||||
|
|
||||||
NoCopyItem, "no_copy_bound", no_copy_bound;
|
NoCopyItem, "no_copy_bound", no_copy_bound;
|
||||||
ManagedItem, "managed_bound", managed_bound;
|
|
||||||
|
|
||||||
NonZeroItem, "non_zero", non_zero;
|
NonZeroItem, "non_zero", non_zero;
|
||||||
|
|
||||||
|
|||||||
@@ -3490,12 +3490,10 @@ def_type_content_sets! {
|
|||||||
// Things that are owned by the value (second and third nibbles):
|
// Things that are owned by the value (second and third nibbles):
|
||||||
OwnsOwned = 0b0000_0000__0000_0001__0000,
|
OwnsOwned = 0b0000_0000__0000_0001__0000,
|
||||||
OwnsDtor = 0b0000_0000__0000_0010__0000,
|
OwnsDtor = 0b0000_0000__0000_0010__0000,
|
||||||
OwnsManaged /* see [1] below */ = 0b0000_0000__0000_0100__0000,
|
|
||||||
OwnsAll = 0b0000_0000__1111_1111__0000,
|
OwnsAll = 0b0000_0000__1111_1111__0000,
|
||||||
|
|
||||||
// Things that are reachable by the value in any way (fourth nibble):
|
// Things that are reachable by the value in any way (fourth nibble):
|
||||||
ReachesBorrowed = 0b0000_0010__0000_0000__0000,
|
ReachesBorrowed = 0b0000_0010__0000_0000__0000,
|
||||||
// ReachesManaged /* see [1] below */ = 0b0000_0100__0000_0000__0000,
|
|
||||||
ReachesMutable = 0b0000_1000__0000_0000__0000,
|
ReachesMutable = 0b0000_1000__0000_0000__0000,
|
||||||
ReachesFfiUnsafe = 0b0010_0000__0000_0000__0000,
|
ReachesFfiUnsafe = 0b0010_0000__0000_0000__0000,
|
||||||
ReachesAll = 0b0011_1111__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
|
// Things that prevent values from being considered sized
|
||||||
Nonsized = 0b0000_0000__0000_0000__0001,
|
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 bits
|
||||||
All = 0b1111_1111__1111_1111__1111
|
All = 0b1111_1111__1111_1111__1111
|
||||||
}
|
}
|
||||||
@@ -3527,10 +3518,6 @@ impl TypeContents {
|
|||||||
(self.bits & tc.bits) != 0
|
(self.bits & tc.bits) != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn owns_managed(&self) -> bool {
|
|
||||||
self.intersects(TC::OwnsManaged)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn owns_owned(&self) -> bool {
|
pub fn owns_owned(&self) -> bool {
|
||||||
self.intersects(TC::OwnsOwned)
|
self.intersects(TC::OwnsOwned)
|
||||||
}
|
}
|
||||||
@@ -3567,12 +3554,6 @@ impl TypeContents {
|
|||||||
*self & TC::ReachesAll)
|
*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 (`*`)
|
/// Includes only those bits that still apply when indirected through an unsafe pointer (`*`)
|
||||||
pub fn unsafe_pointer(&self) -> TypeContents {
|
pub fn unsafe_pointer(&self) -> TypeContents {
|
||||||
*self & TC::ReachesAll
|
*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)
|
fn apply_lang_items(cx: &ctxt, did: ast::DefId, tc: TypeContents)
|
||||||
-> TypeContents {
|
-> TypeContents {
|
||||||
if Some(did) == cx.lang_items.managed_bound() {
|
if Some(did) == cx.lang_items.unsafe_cell_type() {
|
||||||
tc | TC::Managed
|
|
||||||
} else if Some(did) == cx.lang_items.unsafe_cell_type() {
|
|
||||||
tc | TC::InteriorUnsafe
|
tc | TC::InteriorUnsafe
|
||||||
} else {
|
} else {
|
||||||
tc
|
tc
|
||||||
|
|||||||
@@ -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))
|
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") => {
|
(_, "offset") => {
|
||||||
let ptr = llargs[0];
|
let ptr = llargs[0];
|
||||||
let offset = llargs[1];
|
let offset = llargs[1];
|
||||||
|
|||||||
@@ -4945,7 +4945,6 @@ pub fn check_intrinsic_type(ccx: &CrateCtxt, it: &ast::ForeignItem) {
|
|||||||
ty::mk_nil(tcx))
|
ty::mk_nil(tcx))
|
||||||
}
|
}
|
||||||
"needs_drop" => (1, Vec::new(), ccx.tcx.types.bool),
|
"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),
|
"type_name" => (1, Vec::new(), ty::mk_str_slice(tcx, tcx.mk_region(ty::ReStatic),
|
||||||
ast::MutImmutable)),
|
ast::MutImmutable)),
|
||||||
|
|||||||
@@ -12,7 +12,10 @@
|
|||||||
|
|
||||||
#![feature(optin_builtin_traits)]
|
#![feature(optin_builtin_traits)]
|
||||||
|
|
||||||
use std::marker::Managed;
|
struct Managed;
|
||||||
|
impl !Send for Managed {}
|
||||||
|
impl !Sync for Managed {}
|
||||||
|
|
||||||
use std::cell::UnsafeCell;
|
use std::cell::UnsafeCell;
|
||||||
|
|
||||||
struct MySync {
|
struct MySync {
|
||||||
@@ -46,5 +49,5 @@ fn main() {
|
|||||||
//~^ ERROR the trait `core::marker::Sync` is not implemented for the type `core::cell::UnsafeCell<u8>`
|
//~^ ERROR the trait `core::marker::Sync` is not implemented for the type `core::cell::UnsafeCell<u8>`
|
||||||
|
|
||||||
is_sync::<MyTypeManaged>();
|
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`
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user