Skip to content

Commit ca8e563

Browse files
committed
Remove as much of TypeContents as I can -- unfortunately, it is still
used by EUV to compute whether a given type moves-by-default.
1 parent 3694f42 commit ca8e563

File tree

1 file changed

+10
-51
lines changed

1 file changed

+10
-51
lines changed

src/librustc/middle/ty.rs

Lines changed: 10 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2244,35 +2244,25 @@ def_type_content_sets!(
22442244
OwnsAll = 0b0000_0000__1111_1111__0000,
22452245

22462246
// Things that are reachable by the value in any way (fourth nibble):
2247-
ReachesNonsendAnnot = 0b0000_0001__0000_0000__0000,
22482247
ReachesBorrowed = 0b0000_0010__0000_0000__0000,
22492248
// ReachesManaged /* see [1] below */ = 0b0000_0100__0000_0000__0000,
22502249
ReachesMutable = 0b0000_1000__0000_0000__0000,
2251-
ReachesNoSync = 0b0001_0000__0000_0000__0000,
22522250
ReachesFfiUnsafe = 0b0010_0000__0000_0000__0000,
22532251
ReachesAll = 0b0011_1111__0000_0000__0000,
22542252

2255-
// Things that cause values to *move* rather than *copy*
2253+
// Things that cause values to *move* rather than *copy*. This
2254+
// is almost the same as the `Copy` trait, but for managed
2255+
// data -- atm, we consider managed data to copy, not move,
2256+
// but it does not impl Copy as a pure memcpy is not good
2257+
// enough. Yuck.
22562258
Moves = 0b0000_0000__0000_1011__0000,
22572259

22582260
// Things that mean drop glue is necessary
22592261
NeedsDrop = 0b0000_0000__0000_0111__0000,
22602262

2261-
// Things that prevent values from being sent
2262-
//
2263-
// Note: For checking whether something is sendable, it'd
2264-
// be sufficient to have ReachesManaged. However, we include
2265-
// both ReachesManaged and OwnsManaged so that when
2266-
// a parameter has a bound T:Send, we are able to deduce
2267-
// that it neither reaches nor owns a managed pointer.
2268-
Nonsendable = 0b0000_0111__0000_0100__0000,
2269-
22702263
// Things that prevent values from being considered sized
22712264
Nonsized = 0b0000_0000__0000_0000__0001,
22722265

2273-
// Things that prevent values from being sync
2274-
Nonsync = 0b0001_0000__0000_0000__0000,
2275-
22762266
// Things that make values considered not POD (would be same
22772267
// as `Moves`, but for the fact that managed data `@` is
22782268
// not considered POD)
@@ -2291,15 +2281,6 @@ def_type_content_sets!(
22912281
)
22922282

22932283
impl TypeContents {
2294-
pub fn meets_builtin_bound(&self, cx: &ctxt, bb: BuiltinBound) -> bool {
2295-
match bb {
2296-
BoundSend => self.is_sendable(cx),
2297-
BoundSized => self.is_sized(cx),
2298-
BoundCopy => self.is_copy(cx),
2299-
BoundSync => self.is_sync(cx),
2300-
}
2301-
}
2302-
23032284
pub fn when(&self, cond: bool) -> TypeContents {
23042285
if cond {*self} else {TC::None}
23052286
}
@@ -2308,14 +2289,6 @@ impl TypeContents {
23082289
(self.bits & tc.bits) != 0
23092290
}
23102291

2311-
pub fn is_sendable(&self, _: &ctxt) -> bool {
2312-
!self.intersects(TC::Nonsendable)
2313-
}
2314-
2315-
pub fn is_sync(&self, _: &ctxt) -> bool {
2316-
!self.intersects(TC::Nonsync)
2317-
}
2318-
23192292
pub fn owns_managed(&self) -> bool {
23202293
self.intersects(TC::OwnsManaged)
23212294
}
@@ -2328,10 +2301,6 @@ impl TypeContents {
23282301
!self.intersects(TC::Nonsized)
23292302
}
23302303

2331-
pub fn is_copy(&self, _: &ctxt) -> bool {
2332-
!self.intersects(TC::Noncopy)
2333-
}
2334-
23352304
pub fn interior_unsafe(&self) -> bool {
23362305
self.intersects(TC::InteriorUnsafe)
23372306
}
@@ -2416,10 +2385,6 @@ impl fmt::Show for TypeContents {
24162385
}
24172386
}
24182387

2419-
pub fn type_is_sendable(cx: &ctxt, t: ty::t) -> bool {
2420-
type_contents(cx, t).is_sendable(cx)
2421-
}
2422-
24232388
pub fn type_interior_is_unsafe(cx: &ctxt, t: ty::t) -> bool {
24242389
type_contents(cx, t).interior_unsafe()
24252390
}
@@ -2661,19 +2626,14 @@ pub fn type_contents(cx: &ctxt, ty: t) -> TypeContents {
26612626
fn apply_lang_items(cx: &ctxt,
26622627
did: ast::DefId,
26632628
tc: TypeContents)
2664-
-> TypeContents {
2665-
if Some(did) == cx.lang_items.no_send_bound() {
2666-
tc | TC::ReachesNonsendAnnot
2667-
} else if Some(did) == cx.lang_items.managed_bound() {
2629+
-> TypeContents
2630+
{
2631+
if Some(did) == cx.lang_items.managed_bound() {
26682632
tc | TC::Managed
26692633
} else if Some(did) == cx.lang_items.no_copy_bound() {
26702634
tc | TC::OwnsAffine
2671-
} else if Some(did) == cx.lang_items.no_sync_bound() {
2672-
tc | TC::ReachesNoSync
26732635
} else if Some(did) == cx.lang_items.unsafe_type() {
2674-
// FIXME(#13231): This shouldn't be needed after
2675-
// opt-in built-in bounds are implemented.
2676-
(tc | TC::InteriorUnsafe) - TC::Nonsync
2636+
tc | TC::InteriorUnsafe
26772637
} else {
26782638
tc
26792639
}
@@ -2733,10 +2693,9 @@ pub fn type_contents(cx: &ctxt, ty: t) -> TypeContents {
27332693
let mut tc = TC::All;
27342694
each_inherited_builtin_bound(cx, bounds, traits, |bound| {
27352695
tc = tc - match bound {
2736-
BoundSend => TC::Nonsendable,
2696+
BoundSync | BoundSend => TC::None,
27372697
BoundSized => TC::Nonsized,
27382698
BoundCopy => TC::Noncopy,
2739-
BoundSync => TC::Nonsync,
27402699
};
27412700
});
27422701
return tc;

0 commit comments

Comments
 (0)