]> git.lizzy.rs Git - rust.git/commitdiff
Add `Destructible` for replacing `~const Drop`
authorDeadbeef <ent3rm4n@gmail.com>
Sun, 13 Mar 2022 04:04:01 +0000 (15:04 +1100)
committerDeadbeef <ent3rm4n@gmail.com>
Mon, 21 Mar 2022 06:04:02 +0000 (17:04 +1100)
compiler/rustc_hir/src/lang_items.rs
compiler/rustc_span/src/symbol.rs
library/core/src/marker.rs

index b299e71c9c4c45f4d78fc95f6cba527b6fe07b75..05944dd22bd9628216d1688bd5a8b79d033e7665 100644 (file)
@@ -216,6 +216,7 @@ pub fn extract(attrs: &[ast::Attribute]) -> Option<(Symbol, Span)> {
     Freeze,                  sym::freeze,              freeze_trait,               Target::Trait,          GenericRequirement::Exact(0);
 
     Drop,                    sym::drop,                drop_trait,                 Target::Trait,          GenericRequirement::None;
+    Destructible,            sym::destructible,        destructible_trait,         Target::Trait,          GenericRequirement::None;
 
     CoerceUnsized,           sym::coerce_unsized,      coerce_unsized_trait,       Target::Trait,          GenericRequirement::Minimum(1);
     DispatchFromDyn,         sym::dispatch_from_dyn,   dispatch_from_dyn_trait,    Target::Trait,          GenericRequirement::Minimum(1);
index 523a1066a1c3c7a35d7c806420186805517c562d..c07cd86b4e26e7928df43b44a726cbc401ebfba4 100644 (file)
         deref_target,
         derive,
         derive_default_enum,
+        destructible,
         destructuring_assignment,
         diagnostic,
         direct,
index 82bac2640b40596bd6b97e7a9ac5beb35412f716..44d388fb7a3eade95e75a2ba0961dcf0478fd4cf 100644 (file)
@@ -792,6 +792,13 @@ impl<T: ?Sized> Unpin for *const T {}
 #[stable(feature = "pin_raw", since = "1.38.0")]
 impl<T: ?Sized> Unpin for *mut T {}
 
+/// A marker for types that can be dropped.
+///
+/// The compiler logic for this trait is currently unimplemented.
+#[unstable(feature = "const_trait_impl", issue = "67792")]
+#[cfg_attr(not(bootstrap), lang = "destructible")]
+pub trait Destructible {}
+
 /// Implementations of `Copy` for primitive types.
 ///
 /// Implementations that cannot be described in Rust