1use core::{convert::Infallible, ops::Add};
6
7pub enum NoDrop {}
9
10pub enum AutoDrop {}
12
13pub struct CustomDrop<I: DropKind>(core::marker::PhantomData<I>, Infallible);
15
16#[sealed::sealed]
17pub trait DropKind {}
18
19#[sealed::sealed]
20impl DropKind for NoDrop {}
21#[sealed::sealed]
22impl DropKind for AutoDrop {}
23#[sealed::sealed]
24impl DropKind for CustomDrop<NoDrop> {}
25#[sealed::sealed]
26impl DropKind for CustomDrop<AutoDrop> {}
27
28impl Add<Self> for NoDrop {
29 type Output = Self;
30
31 fn add(self, _: Self) -> Self::Output {
32 unreachable!()
33 }
34}
35
36impl Add<AutoDrop> for NoDrop {
37 type Output = AutoDrop;
38
39 fn add(self, _: AutoDrop) -> Self::Output {
40 unreachable!()
41 }
42}
43
44impl<I: DropKind> Add<CustomDrop<I>> for NoDrop {
45 type Output = AutoDrop;
46
47 fn add(self, _: CustomDrop<I>) -> Self::Output {
48 unreachable!()
49 }
50}
51
52impl<Rhs> Add<Rhs> for AutoDrop {
53 type Output = Self;
54
55 fn add(self, _: Rhs) -> Self::Output {
56 unreachable!()
57 }
58}
59
60impl Add<NoDrop> for CustomDrop<NoDrop> {
61 type Output = Self;
62
63 fn add(self, _: NoDrop) -> Self::Output {
64 unreachable!()
65 }
66}
67
68impl Add<AutoDrop> for CustomDrop<NoDrop> {
69 type Output = CustomDrop<AutoDrop>;
70
71 fn add(self, _: AutoDrop) -> Self::Output {
72 unreachable!()
73 }
74}
75
76impl<I: DropKind> Add<CustomDrop<I>> for CustomDrop<NoDrop> {
77 type Output = CustomDrop<AutoDrop>;
78
79 fn add(self, _: CustomDrop<I>) -> Self::Output {
80 unreachable!()
81 }
82}
83
84impl<Rhs> Add<Rhs> for CustomDrop<AutoDrop> {
85 type Output = Self;
86
87 fn add(self, _: Rhs) -> Self::Output {
88 unreachable!()
89 }
90}