@@ -2244,35 +2244,25 @@ def_type_content_sets!(
2244
2244
OwnsAll = 0b0000_0000__1111_1111__0000 ,
2245
2245
2246
2246
// Things that are reachable by the value in any way (fourth nibble):
2247
- ReachesNonsendAnnot = 0b0000_0001__0000_0000__0000 ,
2248
2247
ReachesBorrowed = 0b0000_0010__0000_0000__0000 ,
2249
2248
// ReachesManaged /* see [1] below */ = 0b0000_0100__0000_0000__0000,
2250
2249
ReachesMutable = 0b0000_1000__0000_0000__0000 ,
2251
- ReachesNoSync = 0b0001_0000__0000_0000__0000 ,
2252
2250
ReachesFfiUnsafe = 0b0010_0000__0000_0000__0000 ,
2253
2251
ReachesAll = 0b0011_1111__0000_0000__0000 ,
2254
2252
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.
2256
2258
Moves = 0b0000_0000__0000_1011__0000 ,
2257
2259
2258
2260
// Things that mean drop glue is necessary
2259
2261
NeedsDrop = 0b0000_0000__0000_0111__0000 ,
2260
2262
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
-
2270
2263
// Things that prevent values from being considered sized
2271
2264
Nonsized = 0b0000_0000__0000_0000__0001 ,
2272
2265
2273
- // Things that prevent values from being sync
2274
- Nonsync = 0b0001_0000__0000_0000__0000 ,
2275
-
2276
2266
// Things that make values considered not POD (would be same
2277
2267
// as `Moves`, but for the fact that managed data `@` is
2278
2268
// not considered POD)
@@ -2291,15 +2281,6 @@ def_type_content_sets!(
2291
2281
)
2292
2282
2293
2283
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
-
2303
2284
pub fn when ( & self , cond : bool ) -> TypeContents {
2304
2285
if cond { * self } else { TC :: None }
2305
2286
}
@@ -2308,14 +2289,6 @@ impl TypeContents {
2308
2289
( self . bits & tc. bits ) != 0
2309
2290
}
2310
2291
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
-
2319
2292
pub fn owns_managed ( & self ) -> bool {
2320
2293
self . intersects ( TC :: OwnsManaged )
2321
2294
}
@@ -2328,10 +2301,6 @@ impl TypeContents {
2328
2301
!self . intersects ( TC :: Nonsized )
2329
2302
}
2330
2303
2331
- pub fn is_copy ( & self , _: & ctxt ) -> bool {
2332
- !self . intersects ( TC :: Noncopy )
2333
- }
2334
-
2335
2304
pub fn interior_unsafe ( & self ) -> bool {
2336
2305
self . intersects ( TC :: InteriorUnsafe )
2337
2306
}
@@ -2416,10 +2385,6 @@ impl fmt::Show for TypeContents {
2416
2385
}
2417
2386
}
2418
2387
2419
- pub fn type_is_sendable ( cx : & ctxt , t : ty:: t ) -> bool {
2420
- type_contents ( cx, t) . is_sendable ( cx)
2421
- }
2422
-
2423
2388
pub fn type_interior_is_unsafe ( cx : & ctxt , t : ty:: t ) -> bool {
2424
2389
type_contents ( cx, t) . interior_unsafe ( )
2425
2390
}
@@ -2661,19 +2626,14 @@ pub fn type_contents(cx: &ctxt, ty: t) -> TypeContents {
2661
2626
fn apply_lang_items ( cx : & ctxt ,
2662
2627
did : ast:: DefId ,
2663
2628
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 ( ) {
2668
2632
tc | TC :: Managed
2669
2633
} else if Some ( did) == cx. lang_items . no_copy_bound ( ) {
2670
2634
tc | TC :: OwnsAffine
2671
- } else if Some ( did) == cx. lang_items . no_sync_bound ( ) {
2672
- tc | TC :: ReachesNoSync
2673
2635
} 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
2677
2637
} else {
2678
2638
tc
2679
2639
}
@@ -2733,10 +2693,9 @@ pub fn type_contents(cx: &ctxt, ty: t) -> TypeContents {
2733
2693
let mut tc = TC :: All ;
2734
2694
each_inherited_builtin_bound ( cx, bounds, traits, |bound| {
2735
2695
tc = tc - match bound {
2736
- BoundSend => TC :: Nonsendable ,
2696
+ BoundSync | BoundSend => TC :: None ,
2737
2697
BoundSized => TC :: Nonsized ,
2738
2698
BoundCopy => TC :: Noncopy ,
2739
- BoundSync => TC :: Nonsync ,
2740
2699
} ;
2741
2700
} ) ;
2742
2701
return tc;
0 commit comments