1 #![feature(no_core, lang_items, intrinsics, unboxed_closures)]
9 pub trait Unsize<T: ?Sized> {}
11 #[lang = "coerce_unsized"]
12 pub trait CoerceUnsized<T> {}
14 impl<'a, 'b: 'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<&'a U> for &'b T {}
15 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for *const T {}
16 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*mut U> for *mut T {}
18 #[lang = "dispatch_from_dyn"]
19 pub trait DispatchFromDyn<T> {}
22 impl<'a, T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<&'a U> for &'a T {}
24 impl<'a, T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<&'a mut U> for &'a mut T {}
25 // *const T -> *const U
26 impl<T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<*const U> for *const T {}
28 impl<T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<*mut U> for *mut T {}
31 pub unsafe trait Copy {}
33 unsafe impl Copy for bool {}
34 unsafe impl Copy for u8 {}
35 unsafe impl Copy for u16 {}
36 unsafe impl Copy for u32 {}
37 unsafe impl Copy for u64 {}
38 unsafe impl Copy for usize {}
39 unsafe impl Copy for i8 {}
40 unsafe impl Copy for i16 {}
41 unsafe impl Copy for i32 {}
42 unsafe impl Copy for isize {}
43 unsafe impl Copy for char {}
44 unsafe impl<'a, T: ?Sized> Copy for &'a T {}
45 unsafe impl<T: ?Sized> Copy for *const T {}
48 pub unsafe trait Sync {}
50 unsafe impl Sync for bool {}
51 unsafe impl Sync for u8 {}
52 unsafe impl Sync for u16 {}
53 unsafe impl Sync for u32 {}
54 unsafe impl Sync for u64 {}
55 unsafe impl Sync for usize {}
56 unsafe impl Sync for i8 {}
57 unsafe impl Sync for i16 {}
58 unsafe impl Sync for i32 {}
59 unsafe impl Sync for isize {}
60 unsafe impl Sync for char {}
61 unsafe impl<'a, T: ?Sized> Sync for &'a T {}
62 unsafe impl Sync for [u8; 16] {}
71 fn not(self) -> Self::Output;
77 fn not(self) -> bool {
83 pub trait Mul<RHS = Self> {
87 fn mul(self, rhs: RHS) -> Self::Output;
93 fn mul(self, rhs: Self) -> Self::Output {
99 pub trait Add<RHS = Self> {
102 fn add(self, rhs: RHS) -> Self::Output;
108 fn add(self, rhs: Self) -> Self {
114 pub trait Sub<RHS = Self> {
117 fn sub(self, rhs: RHS) -> Self::Output;
123 fn sub(self, rhs: Self) -> Self {
129 pub trait BitOr<RHS = Self> {
133 fn bitor(self, rhs: RHS) -> Self::Output;
136 impl BitOr for bool {
139 fn bitor(self, rhs: bool) -> bool {
144 impl<'a> BitOr<bool> for &'a bool {
147 fn bitor(self, rhs: bool) -> bool {
153 pub trait PartialEq<Rhs: ?Sized = Self> {
154 fn eq(&self, other: &Rhs) -> bool;
155 fn ne(&self, other: &Rhs) -> bool;
158 impl PartialEq for u8 {
159 fn eq(&self, other: &u8) -> bool {
162 fn ne(&self, other: &u8) -> bool {
167 impl PartialEq for char {
168 fn eq(&self, other: &char) -> bool {
171 fn ne(&self, other: &char) -> bool {
176 impl<T: ?Sized> PartialEq for *const T {
177 fn eq(&self, other: &*const T) -> bool {
180 fn ne(&self, other: &*const T) -> bool {
189 fn neg(self) -> Self::Output;
195 fn neg(self) -> isize {
207 #[lang = "phantom_data"]
208 pub struct PhantomData<T: ?Sized>;
212 pub trait FnOnce<Args> {
215 extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
220 pub trait FnMut<Args>: FnOnce<Args> {
221 extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
225 pub fn panic(_expr_file_line_col: &(&'static str, &'static str, u32, u32)) -> ! {
231 #[lang = "eh_personality"]
232 fn eh_personality() -> ! {
236 #[lang = "drop_in_place"]
237 #[allow(unconditional_recursion)]
238 pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
239 // Code here does not matter - this is replaced by the
240 // real drop glue by the compiler.
241 drop_in_place(to_drop);
244 #[lang = "owned_box"]
245 pub struct Box<T: ?Sized>(*mut T);
247 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Box<U>> for Box<T> {}
249 static mut MY_TINY_HEAP: [u8; 16] = [0; 16];
251 #[lang = "exchange_malloc"]
252 unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
253 &mut MY_TINY_HEAP as *mut [u8; 16] as *mut u8
262 extern "rust-intrinsic" {
264 pub fn size_of<T>() -> usize;
265 pub fn size_of_val<T: ?::Sized>(val: &T) -> usize;
266 pub fn min_align_of<T>() -> usize;
267 pub fn min_align_of_val<T: ?::Sized>(val: &T) -> usize;
268 pub fn copy<T>(src: *const T, dst: *mut T, count: usize);
269 pub fn transmute<T, U>(e: T) -> U;
270 pub fn uninit<T>() -> T;
271 pub fn ctlz_nonzero<T>(x: T) -> T;
272 pub fn needs_drop<T>() -> bool;
277 pub trait Index<Idx: ?Sized> {
279 fn index(&self, index: Idx) -> &Self::Output;
282 impl<T> Index<usize> for [T; 3] {
285 fn index(&self, index: usize) -> &Self::Output {
290 impl<T> Index<usize> for [T] {
293 fn index(&self, index: usize) -> &Self::Output {