Skip to content

Commit f3345cb

Browse files
committed
Auto merge of #24778 - nagisa:managed-removal, r=huonw
Leftovers from @-pointer times, I guess.
2 parents 613109d + a23d7e1 commit f3345cb

File tree

7 files changed

+6
-43
lines changed

7 files changed

+6
-43
lines changed

src/libcore/intrinsics.rs

-3
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,6 @@ extern "rust-intrinsic" {
267267
/// `Copy`, then may return `true` or `false`.
268268
pub fn needs_drop<T>() -> bool;
269269

270-
/// Returns `true` if a type is managed (will be allocated on the local heap)
271-
pub fn owns_managed<T>() -> bool;
272-
273270
/// Calculates the offset from a pointer.
274271
///
275272
/// This is implemented as an intrinsic to avoid converting to and from an

src/libcore/marker.rs

-10
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ unsafe impl Send for .. { }
4343

4444
impl<T> !Send for *const T { }
4545
impl<T> !Send for *mut T { }
46-
impl !Send for Managed { }
4746

4847
/// Types with a constant size known at compile-time.
4948
#[stable(feature = "rust1", since = "1.0.0")]
@@ -212,7 +211,6 @@ unsafe impl Sync for .. { }
212211

213212
impl<T> !Sync for *const T { }
214213
impl<T> !Sync for *mut T { }
215-
impl !Sync for Managed { }
216214

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

226-
/// A type which is considered managed by the GC. This is typically
227-
/// embedded in other types.
228-
#[unstable(feature = "core",
229-
reason = "likely to change with new variance strategy")]
230-
#[lang="managed_bound"]
231-
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
232-
pub struct Managed;
233-
234224
macro_rules! impls{
235225
($t: ident) => (
236226
impl<T:?Sized> Hash for $t<T> {

src/librustc/middle/lang_items.rs

-1
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,6 @@ lets_do_this! {
334334
InvariantLifetimeItem, "invariant_lifetime", invariant_lifetime;
335335

336336
NoCopyItem, "no_copy_bound", no_copy_bound;
337-
ManagedItem, "managed_bound", managed_bound;
338337

339338
NonZeroItem, "non_zero", non_zero;
340339

src/librustc/middle/ty.rs

+1-22
Original file line numberDiff line numberDiff line change
@@ -3603,12 +3603,10 @@ def_type_content_sets! {
36033603
// Things that are owned by the value (second and third nibbles):
36043604
OwnsOwned = 0b0000_0000__0000_0001__0000,
36053605
OwnsDtor = 0b0000_0000__0000_0010__0000,
3606-
OwnsManaged /* see [1] below */ = 0b0000_0000__0000_0100__0000,
36073606
OwnsAll = 0b0000_0000__1111_1111__0000,
36083607

36093608
// Things that are reachable by the value in any way (fourth nibble):
36103609
ReachesBorrowed = 0b0000_0010__0000_0000__0000,
3611-
// ReachesManaged /* see [1] below */ = 0b0000_0100__0000_0000__0000,
36123610
ReachesMutable = 0b0000_1000__0000_0000__0000,
36133611
ReachesFfiUnsafe = 0b0010_0000__0000_0000__0000,
36143612
ReachesAll = 0b0011_1111__0000_0000__0000,
@@ -3619,13 +3617,6 @@ def_type_content_sets! {
36193617
// Things that prevent values from being considered sized
36203618
Nonsized = 0b0000_0000__0000_0000__0001,
36213619

3622-
// Bits to set when a managed value is encountered
3623-
//
3624-
// [1] Do not set the bits TC::OwnsManaged or
3625-
// TC::ReachesManaged directly, instead reference
3626-
// TC::Managed to set them both at once.
3627-
Managed = 0b0000_0100__0000_0100__0000,
3628-
36293620
// All bits
36303621
All = 0b1111_1111__1111_1111__1111
36313622
}
@@ -3640,10 +3631,6 @@ impl TypeContents {
36403631
(self.bits & tc.bits) != 0
36413632
}
36423633

3643-
pub fn owns_managed(&self) -> bool {
3644-
self.intersects(TC::OwnsManaged)
3645-
}
3646-
36473634
pub fn owns_owned(&self) -> bool {
36483635
self.intersects(TC::OwnsOwned)
36493636
}
@@ -3680,12 +3667,6 @@ impl TypeContents {
36803667
*self & TC::ReachesAll)
36813668
}
36823669

3683-
/// Includes only those bits that still apply when indirected through a managed pointer (`@`)
3684-
pub fn managed_pointer(&self) -> TypeContents {
3685-
TC::Managed | (
3686-
*self & TC::ReachesAll)
3687-
}
3688-
36893670
/// Includes only those bits that still apply when indirected through an unsafe pointer (`*`)
36903671
pub fn unsafe_pointer(&self) -> TypeContents {
36913672
*self & TC::ReachesAll
@@ -3930,9 +3911,7 @@ pub fn type_contents<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> TypeContents {
39303911

39313912
fn apply_lang_items(cx: &ctxt, did: ast::DefId, tc: TypeContents)
39323913
-> TypeContents {
3933-
if Some(did) == cx.lang_items.managed_bound() {
3934-
tc | TC::Managed
3935-
} else if Some(did) == cx.lang_items.unsafe_cell_type() {
3914+
if Some(did) == cx.lang_items.unsafe_cell_type() {
39363915
tc | TC::InteriorUnsafe
39373916
} else {
39383917
tc

src/librustc_trans/trans/intrinsic.rs

-4
Original file line numberDiff line numberDiff line change
@@ -387,10 +387,6 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
387387

388388
C_bool(ccx, bcx.fcx.type_needs_drop(tp_ty))
389389
}
390-
(_, "owns_managed") => {
391-
let tp_ty = *substs.types.get(FnSpace, 0);
392-
C_bool(ccx, ty::type_contents(ccx.tcx(), tp_ty).owns_managed())
393-
}
394390
(_, "offset") => {
395391
let ptr = llargs[0];
396392
let offset = llargs[1];

src/librustc_typeck/check/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4944,7 +4944,6 @@ pub fn check_intrinsic_type(ccx: &CrateCtxt, it: &ast::ForeignItem) {
49444944
ty::mk_nil(tcx))
49454945
}
49464946
"needs_drop" => (1, Vec::new(), ccx.tcx.types.bool),
4947-
"owns_managed" => (1, Vec::new(), ccx.tcx.types.bool),
49484947

49494948
"type_name" => (1, Vec::new(), ty::mk_str_slice(tcx, tcx.mk_region(ty::ReStatic),
49504949
ast::MutImmutable)),

src/test/compile-fail/typeck-default-trait-impl-negation-sync.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212

1313
#![feature(optin_builtin_traits)]
1414

15-
use std::marker::Managed;
15+
struct Managed;
16+
impl !Send for Managed {}
17+
impl !Sync for Managed {}
18+
1619
use std::cell::UnsafeCell;
1720

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

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

0 commit comments

Comments
 (0)