Skip to content

Commit aefc00e

Browse files
compiler-errorsgitbot
authored and
gitbot
committed
Implement and use BikeshedGuaranteedNoDrop for union/unsafe field validity
1 parent abf47c9 commit aefc00e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

core/src/marker.rs

+17
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,23 @@ impl Copy for ! {}
453453
#[stable(feature = "rust1", since = "1.0.0")]
454454
impl<T: ?Sized> Copy for &T {}
455455

456+
/// Marker trait for the types that are allowed in union fields, unsafe fields,
457+
/// and unsafe binder types.
458+
///
459+
/// Implemented for:
460+
/// * `&T`, `&mut T` for all `T`,
461+
/// * `ManuallyDrop<T>` for all `T`,
462+
/// * tuples and arrays whose elements implement `BikeshedGuaranteedNoDrop`,
463+
/// * or otherwise, all types that are `Copy`.
464+
///
465+
/// Notably, this doesn't include all trivially-destructible types for semver
466+
/// reasons.
467+
///
468+
/// Bikeshed name for now.
469+
#[unstable(feature = "bikeshed_guaranteed_no_drop", issue = "none")]
470+
#[cfg_attr(not(bootstrap), lang = "bikeshed_guaranteed_no_drop")]
471+
pub trait BikeshedGuaranteedNoDrop {}
472+
456473
/// Types for which it is safe to share references between threads.
457474
///
458475
/// This trait is automatically implemented when the compiler determines

0 commit comments

Comments
 (0)