drop_with_owned_fields/
_lib.rs1#![doc = include_str!("../README.md")]
9#![no_std]
10#![allow(unused_braces)]
11
12pub
14mod prelude {
15 pub use crate::{
16 drop_with_owned_fields,
17 DropWithOwnedFields,
18 DestructuredFieldsOf,
19 };
20}
21
22mod seal {
23 #[diagnostic::on_unimplemented(
24 message = "missing `#[drop_with_owned_fields]` annotation on this type",
25 )]
26 #[allow(drop_bounds, nonstandard_style)]
27 pub trait drop_with_owned_fields_annotation : Drop {}
28}
29
30pub
31trait DestructureFields : seal::drop_with_owned_fields_annotation {
32 type DestructuredFields;
33
34 fn destructure_fields_disabling_extra_drop(self)
35 -> Self::DestructuredFields
36 ;
37}
38
39#[diagnostic::on_unimplemented(
40 note = "\
41 The `#[drop_with_owned_fields]` annotation expects 🫵 you to provide \
42 a companion `impl` of `DropWithOwnedFields` (the whole point!).\n\
43 \n\
44 If you have enabled the `\"drop-sugar\"` Cargo feature, you can even write \
45 a direct `impl` of `Drop` instead, but with a `#[drop_with_owned_fields]` \
46 annotation on top of it.\n\
47 ",
48)]
49pub
50trait DropWithOwnedFields : DestructureFields {
51 fn drop(owned_fields: DestructuredFieldsOf<Self>);
52}
53
54#[allow(type_alias_bounds)]
55pub
56type DestructuredFieldsOf<T : ?Sized + DestructureFields> = T::DestructuredFields;
57
58pub use ::drop_with_owned_fields_proc_macros::drop_with_owned_fields;
60
61#[doc(hidden)] pub
63mod ඞ {
64 pub use ::core; pub use ::drop_with_owned_fields_proc_macros::ඞannihilate as annihilate;
66 pub use crate::seal::drop_with_owned_fields_annotation;
67
68 pub union ConstTransmuteUnchecked<Src, Dst> {
69 pub src: ::core::mem::ManuallyDrop<Src>,
70 pub dst: ::core::mem::ManuallyDrop<Dst>,
71 }
72}
73
74#[doc = include_str!("compile_fail_tests.md")]
75mod _compile_fail_tests {}