1 #![feature(no_core, lang_items, intrinsics, unboxed_closures, type_ascription)]
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<'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<&'a mut U> for &'a mut T {}
16 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for *const T {}
17 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*mut U> for *mut T {}
19 #[lang = "dispatch_from_dyn"]
20 pub trait DispatchFromDyn<T> {}
23 impl<'a, T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<&'a U> for &'a T {}
25 impl<'a, T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<&'a mut U> for &'a mut T {}
26 // *const T -> *const U
27 impl<T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<*const U> for *const T {}
29 impl<T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<*mut U> for *mut T {}
34 impl<T: ?Sized> Receiver for &T {}
35 impl<T: ?Sized> Receiver for &mut T {}
36 impl<T: ?Sized> Receiver for Box<T> {}
39 pub unsafe trait Copy {}
41 unsafe impl Copy for bool {}
42 unsafe impl Copy for u8 {}
43 unsafe impl Copy for u16 {}
44 unsafe impl Copy for u32 {}
45 unsafe impl Copy for u64 {}
46 unsafe impl Copy for usize {}
47 unsafe impl Copy for i8 {}
48 unsafe impl Copy for i16 {}
49 unsafe impl Copy for i32 {}
50 unsafe impl Copy for isize {}
51 unsafe impl Copy for char {}
52 unsafe impl<'a, T: ?Sized> Copy for &'a T {}
53 unsafe impl<T: ?Sized> Copy for *const T {}
54 unsafe impl<T: ?Sized> Copy for *mut T {}
57 pub unsafe trait Sync {}
59 unsafe impl Sync for bool {}
60 unsafe impl Sync for u8 {}
61 unsafe impl Sync for u16 {}
62 unsafe impl Sync for u32 {}
63 unsafe impl Sync for u64 {}
64 unsafe impl Sync for usize {}
65 unsafe impl Sync for i8 {}
66 unsafe impl Sync for i16 {}
67 unsafe impl Sync for i32 {}
68 unsafe impl Sync for isize {}
69 unsafe impl Sync for char {}
70 unsafe impl<'a, T: ?Sized> Sync for &'a T {}
71 unsafe impl Sync for [u8; 16] {}
80 fn not(self) -> Self::Output;
86 fn not(self) -> bool {
92 pub trait Mul<RHS = Self> {
96 fn mul(self, rhs: RHS) -> Self::Output;
102 fn mul(self, rhs: Self) -> Self::Output {
108 pub trait Add<RHS = Self> {
111 fn add(self, rhs: RHS) -> Self::Output;
117 fn add(self, rhs: Self) -> Self {
125 fn add(self, rhs: Self) -> Self {
131 pub trait Sub<RHS = Self> {
134 fn sub(self, rhs: RHS) -> Self::Output;
140 fn sub(self, rhs: Self) -> Self {
146 pub trait BitOr<RHS = Self> {
150 fn bitor(self, rhs: RHS) -> Self::Output;
153 impl BitOr for bool {
156 fn bitor(self, rhs: bool) -> bool {
161 impl<'a> BitOr<bool> for &'a bool {
164 fn bitor(self, rhs: bool) -> bool {
170 pub trait PartialEq<Rhs: ?Sized = Self> {
171 fn eq(&self, other: &Rhs) -> bool;
172 fn ne(&self, other: &Rhs) -> bool;
175 impl PartialEq for u8 {
176 fn eq(&self, other: &u8) -> bool {
179 fn ne(&self, other: &u8) -> bool {
184 impl PartialEq for u16 {
185 fn eq(&self, other: &u16) -> bool {
188 fn ne(&self, other: &u16) -> bool {
193 impl PartialEq for u32 {
194 fn eq(&self, other: &u32) -> bool {
197 fn ne(&self, other: &u32) -> bool {
202 impl PartialEq for usize {
203 fn eq(&self, other: &usize) -> bool {
206 fn ne(&self, other: &usize) -> bool {
211 impl PartialEq for char {
212 fn eq(&self, other: &char) -> bool {
215 fn ne(&self, other: &char) -> bool {
220 impl<T: ?Sized> PartialEq for *const T {
221 fn eq(&self, other: &*const T) -> bool {
224 fn ne(&self, other: &*const T) -> bool {
233 fn neg(self) -> Self::Output;
239 fn neg(self) -> isize {
251 #[lang = "phantom_data"]
252 pub struct PhantomData<T: ?Sized>;
256 pub trait FnOnce<Args> {
259 extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
264 pub trait FnMut<Args>: FnOnce<Args> {
265 extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
269 // Make it available to jited mini_core_hello_world
270 // FIXME remove next line when jit supports linking rlibs
272 pub fn panic(&(_msg, _file, _line, _col): &(&'static str, &'static str, u32, u32)) -> ! {
274 libc::puts("Panicking\0" as *const str as *const u8);
279 #[lang = "eh_personality"]
280 fn eh_personality() -> ! {
284 #[lang = "drop_in_place"]
285 #[allow(unconditional_recursion)]
286 pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
287 // Code here does not matter - this is replaced by the
288 // real drop glue by the compiler.
289 drop_in_place(to_drop);
292 #[lang = "owned_box"]
293 pub struct Box<T: ?Sized>(*mut T);
295 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Box<U>> for Box<T> {}
297 #[lang = "exchange_malloc"]
298 // Make it available to jited mini_core_hello_world
299 // FIXME remove next line when jit supports linking rlibs
301 unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
311 extern "rust-intrinsic" {
313 pub fn size_of<T>() -> usize;
314 pub fn size_of_val<T: ?::Sized>(val: &T) -> usize;
315 pub fn min_align_of<T>() -> usize;
316 pub fn min_align_of_val<T: ?::Sized>(val: &T) -> usize;
317 pub fn copy<T>(src: *const T, dst: *mut T, count: usize);
318 pub fn transmute<T, U>(e: T) -> U;
319 pub fn uninit<T>() -> T;
320 pub fn ctlz_nonzero<T>(x: T) -> T;
321 pub fn needs_drop<T>() -> bool;
328 pub fn puts(s: *const u8);
329 pub fn malloc(size: usize) -> *mut u8;
330 pub fn memcpy(dst: *mut u8, src: *const u8, size: usize);
331 pub fn memmove(dst: *mut u8, src: *const u8, size: usize);
332 pub fn strncpy(dst: *mut u8, src: *const u8, size: usize);
337 pub trait Index<Idx: ?Sized> {
339 fn index(&self, index: Idx) -> &Self::Output;
342 impl<T> Index<usize> for [T; 3] {
345 fn index(&self, index: usize) -> &Self::Output {
350 impl<T> Index<usize> for [T] {
353 fn index(&self, index: usize) -> &Self::Output {