1pub use self::imp::*;
2
3#[cfg(not(cross_platform_docs))]
4mod imp {
5 pub use core::option::Option;
6 pub use core::clone::Clone;
7 pub use core::cmp::{PartialEq, Eq};
8 pub use core::marker::Copy;
9 pub use core::mem;
10}
11
12#[cfg(cross_platform_docs)]
13mod imp {
14 pub enum Option<T> {
15 Some(T),
16 None,
17 }
18 impl<T: Copy> Copy for Option<T> {}
19 impl<T: Clone> Clone for Option<T> {
20 fn clone(&self) -> Option<T> { loop {} }
21 }
22
23 impl<T> Copy for *mut T {}
24 impl<T> Clone for *mut T {
25 fn clone(&self) -> *mut T { loop {} }
26 }
27
28 impl<T> Copy for *const T {}
29 impl<T> Clone for *const T {
30 fn clone(&self) -> *const T { loop {} }
31 }
32
33 pub trait Clone {
34 fn clone(&self) -> Self;
35 }
36
37 #[lang = "copy"]
38 pub trait Copy {}
39
40 #[lang = "freeze"]
41 pub trait Freeze {}
42
43 #[lang = "sync"]
44 pub trait Sync {}
45 impl<T> Sync for T {}
46
47 #[lang = "sized"]
48 pub trait Sized {}
49
50 macro_rules! each_int {
51 ($mac:ident) => (
52 $mac!(u8);
53 $mac!(u16);
54 $mac!(u32);
55 $mac!(u64);
56 $mac!(usize);
57 each_signed_int!($mac);
58 )
59 }
60
61 macro_rules! each_signed_int {
62 ($mac:ident) => (
63 $mac!(i8);
64 $mac!(i16);
65 $mac!(i32);
66 $mac!(i64);
67 $mac!(isize);
68 )
69 }
70
71 #[lang = "div"]
72 pub trait Div<RHS=Self> {
73 type Output;
74 fn div(self, rhs: RHS) -> Self::Output;
75 }
76
77 #[lang = "shl"]
78 pub trait Shl<RHS=Self> {
79 type Output;
80 fn shl(self, rhs: RHS) -> Self::Output;
81 }
82
83 #[lang = "mul"]
84 pub trait Mul<RHS=Self> {
85 type Output;
86 fn mul(self, rhs: RHS) -> Self::Output;
87 }
88
89 #[lang = "sub"]
90 pub trait Sub<RHS=Self> {
91 type Output;
92 fn sub(self, rhs: RHS) -> Self::Output;
93 }
94
95 #[lang = "bitand"]
96 pub trait BitAnd<RHS=Self> {
97 type Output;
98 fn bitand(self, rhs: RHS) -> Self::Output;
99 }
100
101 #[lang = "bitand_assign"]
102 pub trait BitAndAssign<RHS = Self> {
103 fn bitand_assign(&mut self, rhs: RHS);
104 }
105
106 #[lang = "bitor"]
107 pub trait BitOr<RHS=Self> {
108 type Output;
109 fn bitor(self, rhs: RHS) -> Self::Output;
110 }
111
112 #[lang = "bitor_assign"]
113 pub trait BitOrAssign<RHS = Self> {
114 fn bitor_assign(&mut self, rhs: RHS);
115 }
116
117 #[lang = "bitxor"]
118 pub trait BitXor<RHS=Self> {
119 type Output;
120 fn bitxor(self, rhs: RHS) -> Self::Output;
121 }
122
123 #[lang = "bitxor_assign"]
124 pub trait BitXorAssign<RHS = Self> {
125 fn bitxor_assign(&mut self, rhs: RHS);
126 }
127
128 #[lang = "neg"]
129 pub trait Neg {
130 type Output;
131 fn neg(self) -> Self::Output;
132 }
133
134 #[lang = "not"]
135 pub trait Not {
136 type Output;
137 fn not(self) -> Self::Output;
138 }
139
140 #[lang = "add"]
141 pub trait Add<RHS = Self> {
142 type Output;
143 fn add(self, r: RHS) -> Self::Output;
144 }
145
146 macro_rules! impl_traits {
147 ($($i:ident)*) => ($(
148 impl Div<$i> for $i {
149 type Output = $i;
150 fn div(self, rhs: $i) -> $i { self / rhs }
151 }
152 impl Shl<$i> for $i {
153 type Output = $i;
154 fn shl(self, rhs: $i) -> $i { self << rhs }
155 }
156 impl Mul for $i {
157 type Output = $i;
158 fn mul(self, rhs: $i) -> $i { self * rhs }
159 }
160
161 impl Sub for $i {
162 type Output = $i;
163 fn sub(self, rhs: $i) -> $i { self - rhs }
164 }
165 impl BitAnd for $i {
166 type Output = $i;
167 fn bitand(self, rhs: $i) -> $i { self & rhs }
168 }
169 impl BitAndAssign for $i {
170 fn bitand_assign(&mut self, rhs: $i) { *self &= rhs; }
171 }
172 impl BitOr for $i {
173 type Output = $i;
174 fn bitor(self, rhs: $i) -> $i { self | rhs }
175 }
176 impl BitOrAssign for $i {
177 fn bitor_assign(&mut self, rhs: $i) { *self |= rhs; }
178 }
179 impl BitXor for $i {
180 type Output = $i;
181 fn bitxor(self, rhs: $i) -> $i { self ^ rhs }
182 }
183 impl BitXorAssign for $i {
184 fn bitxor_assign(&mut self, rhs: $i) { *self ^= rhs; }
185 }
186 impl Neg for $i {
187 type Output = $i;
188 fn neg(self) -> $i { -self }
189 }
190 impl Not for $i {
191 type Output = $i;
192 fn not(self) -> $i { !self }
193 }
194 impl Add<$i> for $i {
195 type Output = $i;
196 fn add(self, other: $i) -> $i { self + other }
197 }
198 impl Copy for $i {}
199 impl Clone for $i {
200 fn clone(&self) -> $i { loop {} }
201 }
202 )*)
203 }
204 each_int!(impl_traits);
205
206 pub mod mem {
207 pub fn size_of_val<T>(_: &T) -> usize { 4 }
208 pub const fn size_of<T>() -> usize { 4 }
209 }
210}