]> git.proxmox.com Git - rustc.git/blob - src/liblibc/src/dox.rs
Imported Upstream version 1.6.0+dfsg1
[rustc.git] / src / liblibc / src / dox.rs
1 pub use self::imp::*;
2
3 #[cfg(not(dox))]
4 mod imp {
5 pub use core::option::Option;
6 pub use core::clone::Clone;
7 pub use core::marker::Copy;
8 pub use core::mem;
9 }
10
11 #[cfg(dox)]
12 mod imp {
13 pub enum Option<T> {
14 Some(T),
15 None,
16 }
17 impl<T: Copy> Copy for Option<T> {}
18 impl<T: Clone> Clone for Option<T> {
19 fn clone(&self) -> Option<T> { loop {} }
20 }
21
22 pub trait Clone {
23 fn clone(&self) -> Self;
24 }
25
26 #[lang = "copy"]
27 pub trait Copy {}
28
29 #[lang = "sized"]
30 pub trait Sized {}
31
32 macro_rules! each_int {
33 ($mac:ident) => (
34 $mac!(u8);
35 $mac!(u16);
36 $mac!(u32);
37 $mac!(u64);
38 $mac!(usize);
39 $mac!(i8);
40 $mac!(i16);
41 $mac!(i32);
42 $mac!(i64);
43 $mac!(isize);
44 )
45 }
46
47 #[lang = "div"]
48 pub trait Div<RHS> {
49 type Output;
50 fn div(self, rhs: RHS) -> Self::Output;
51 }
52
53 macro_rules! impl_div {
54 ($($i:ident)*) => ($(
55 impl Div<$i> for $i {
56 type Output = $i;
57 fn div(self, rhs: $i) -> $i { self / rhs }
58 }
59 )*)
60 }
61 each_int!(impl_div);
62
63 #[lang = "shl"]
64 pub trait Shl<RHS> {
65 type Output;
66 fn shl(self, rhs: RHS) -> Self::Output;
67 }
68
69 macro_rules! impl_shl {
70 ($($i:ident)*) => ($(
71 impl Shl<$i> for $i {
72 type Output = $i;
73 fn shl(self, rhs: $i) -> $i { self << rhs }
74 }
75 )*)
76 }
77 each_int!(impl_shl);
78
79 #[lang = "mul"]
80 pub trait Mul<RHS=Self> {
81 type Output;
82 fn mul(self, rhs: RHS) -> Self::Output;
83 }
84
85 macro_rules! impl_mul {
86 ($($i:ident)*) => ($(
87 impl Mul for $i {
88 type Output = $i;
89 fn mul(self, rhs: $i) -> $i { self * rhs }
90 }
91 )*)
92 }
93 each_int!(impl_mul);
94
95 #[lang = "sub"]
96 pub trait Sub<RHS=Self> {
97 type Output;
98 fn sub(self, rhs: RHS) -> Self::Output;
99 }
100
101 macro_rules! impl_sub {
102 ($($i:ident)*) => ($(
103 impl Sub for $i {
104 type Output = $i;
105 fn sub(self, rhs: $i) -> $i { self - rhs }
106 }
107 )*)
108 }
109 each_int!(impl_sub);
110
111 #[lang = "bitor"]
112 pub trait Bitor<RHS=Self> {
113 type Output;
114 fn bitor(self, rhs: RHS) -> Self::Output;
115 }
116
117 macro_rules! impl_bitor {
118 ($($i:ident)*) => ($(
119 impl Bitor for $i {
120 type Output = $i;
121 fn bitor(self, rhs: $i) -> $i { self | rhs }
122 }
123 )*)
124 }
125 each_int!(impl_bitor);
126
127 pub mod mem {
128 pub fn size_of_val<T>(_: &T) -> usize { 4 }
129 }
130 }