Skip to main content

announce_std/
cmp.rs

1//! announce mocks of `cmp` traits. Generated from newer-type-std's copies.
2
3#[allow(unused_imports)]
4use announce::announce;
5
6/// announce mock of [`::core::cmp::PartialEq`]: invoke `PartialEq!` to receive its definition.
7///
8/// The real trait is available under the same path in the type namespace
9/// (from rustc 1.94, through a glob re-export, since the macro namespace holds this
10/// trampoline).
11#[announce(mock = ::core::cmp::PartialEq)]
12pub trait PartialEq<Rhs = Self>
13where
14    Rhs: ?::core::marker::Sized,
15{
16    fn eq(&self, other: &Rhs) -> ::core::primitive::bool;
17    fn ne(&self, other: &Rhs) -> ::core::primitive::bool {
18        ::core::unimplemented!()
19    }
20}
21
22#[cfg(not(announce_std_rust_1_94))]
23/// Fallback for rustc < 1.94: a blanket subtrait of [`::core::cmp::PartialEq`], usable in bounds.
24pub trait PartialEq<Rhs: ?::core::marker::Sized = Self>: ::core::cmp::PartialEq<Rhs> {}
25#[cfg(not(announce_std_rust_1_94))]
26impl<__T: ?::core::marker::Sized + ::core::cmp::PartialEq<Rhs>, Rhs: ?::core::marker::Sized>
27    PartialEq<Rhs> for __T
28{
29}
30
31/// announce mock of [`::core::cmp::Eq`]: invoke `Eq!` to receive its definition.
32///
33/// The real trait is available under the same path in the type namespace
34/// (from rustc 1.94, through a glob re-export, since the macro namespace holds this
35/// trampoline).
36#[announce(mock = ::core::cmp::Eq)]
37pub trait Eq: ::core::cmp::PartialEq {}
38
39#[cfg(not(announce_std_rust_1_94))]
40/// Fallback for rustc < 1.94: a blanket subtrait of [`::core::cmp::Eq`], usable in bounds.
41pub trait Eq: ::core::cmp::Eq {}
42#[cfg(not(announce_std_rust_1_94))]
43impl<__T: ?::core::marker::Sized + ::core::cmp::Eq> Eq for __T {}
44
45/// announce mock of [`::core::cmp::PartialOrd`]: invoke `PartialOrd!` to receive its definition.
46///
47/// The real trait is available under the same path in the type namespace
48/// (from rustc 1.94, through a glob re-export, since the macro namespace holds this
49/// trampoline).
50#[announce(mock = ::core::cmp::PartialOrd)]
51pub trait PartialOrd<Rhs = Self>: ::core::cmp::PartialEq<Rhs>
52where
53    Rhs: ?::core::marker::Sized,
54{
55    fn partial_cmp(&self, other: &Rhs) -> ::core::option::Option<::core::cmp::Ordering>;
56
57    fn lt(&self, other: &Rhs) -> ::core::primitive::bool {
58        ::core::unimplemented!()
59    }
60    fn le(&self, other: &Rhs) -> ::core::primitive::bool {
61        ::core::unimplemented!()
62    }
63    fn gt(&self, other: &Rhs) -> ::core::primitive::bool {
64        ::core::unimplemented!()
65    }
66    fn ge(&self, other: &Rhs) -> ::core::primitive::bool {
67        ::core::unimplemented!()
68    }
69}
70
71#[cfg(not(announce_std_rust_1_94))]
72/// Fallback for rustc < 1.94: a blanket subtrait of [`::core::cmp::PartialOrd`], usable in bounds.
73pub trait PartialOrd<Rhs: ?::core::marker::Sized = Self>: ::core::cmp::PartialOrd<Rhs> {}
74#[cfg(not(announce_std_rust_1_94))]
75impl<__T: ?::core::marker::Sized + ::core::cmp::PartialOrd<Rhs>, Rhs: ?::core::marker::Sized>
76    PartialOrd<Rhs> for __T
77{
78}
79
80/// announce mock of [`::core::cmp::Ord`]: invoke `Ord!` to receive its definition.
81///
82/// The real trait is available under the same path in the type namespace
83/// (from rustc 1.94, through a glob re-export, since the macro namespace holds this
84/// trampoline).
85#[announce(mock = ::core::cmp::Ord)]
86pub trait Ord: ::core::cmp::Eq + ::core::cmp::PartialOrd {
87    fn cmp(&self, other: &Self) -> ::core::cmp::Ordering;
88    // fn max(self, other: Self) -> Self
89    // where
90    //     Self: ::core::marker::Sized;
91    // fn min(self, other: Self) -> Self
92    // where
93    //     Self: ::core::marker::Sized;
94    // fn clamp(self, min: Self, max: Self) -> Self
95    // where
96    //     Self: ::core::marker::Sized;
97}
98
99#[cfg(not(announce_std_rust_1_94))]
100/// Fallback for rustc < 1.94: a blanket subtrait of [`::core::cmp::Ord`], usable in bounds.
101pub trait Ord: ::core::cmp::Ord {}
102#[cfg(not(announce_std_rust_1_94))]
103impl<__T: ?::core::marker::Sized + ::core::cmp::Ord> Ord for __T {}
104
105// Real traits whose name is also a derive macro: explicit names shadow glob
106// imports per namespace, so this glob supplies the *trait* while the announce
107// trampoline above keeps the *macro* namespace. Before rustc 1.94 the glob
108// breaks the trampoline's resolution, so it is only emitted from 1.94 on.
109#[cfg(announce_std_rust_1_94)]
110#[doc(hidden)]
111pub mod __real {
112
113    pub use ::core::cmp::PartialEq;
114
115    pub use ::core::cmp::Eq;
116
117    pub use ::core::cmp::PartialOrd;
118
119    pub use ::core::cmp::Ord;
120}
121#[cfg(announce_std_rust_1_94)]
122#[doc(no_inline)]
123pub use self::__real::*;