1 #![feature(no_core, lang_items, intrinsics, unboxed_closures, type_ascription, extern_types, untagged_unions)]
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 {}
30 impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Box<U>> for Box<T> {}
35 impl<T: ?Sized> Receiver for &T {}
36 impl<T: ?Sized> Receiver for &mut T {}
37 impl<T: ?Sized> Receiver for Box<T> {}
40 pub unsafe trait Copy {}
42 unsafe impl Copy for bool {}
43 unsafe impl Copy for u8 {}
44 unsafe impl Copy for u16 {}
45 unsafe impl Copy for u32 {}
46 unsafe impl Copy for u64 {}
47 unsafe impl Copy for u128 {}
48 unsafe impl Copy for usize {}
49 unsafe impl Copy for i8 {}
50 unsafe impl Copy for i16 {}
51 unsafe impl Copy for i32 {}
52 unsafe impl Copy for i128 {}
53 unsafe impl Copy for isize {}
54 unsafe impl Copy for char {}
55 unsafe impl<'a, T: ?Sized> Copy for &'a T {}
56 unsafe impl<T: ?Sized> Copy for *const T {}
57 unsafe impl<T: ?Sized> Copy for *mut T {}
60 pub unsafe trait Sync {}
62 unsafe impl Sync for bool {}
63 unsafe impl Sync for u8 {}
64 unsafe impl Sync for u16 {}
65 unsafe impl Sync for u32 {}
66 unsafe impl Sync for u64 {}
67 unsafe impl Sync for usize {}
68 unsafe impl Sync for i8 {}
69 unsafe impl Sync for i16 {}
70 unsafe impl Sync for i32 {}
71 unsafe impl Sync for isize {}
72 unsafe impl Sync for char {}
73 unsafe impl<'a, T: ?Sized> Sync for &'a T {}
74 unsafe impl Sync for [u8; 16] {}
83 fn not(self) -> Self::Output;
89 fn not(self) -> bool {
95 pub trait Mul<RHS = Self> {
99 fn mul(self, rhs: RHS) -> Self::Output;
105 fn mul(self, rhs: Self) -> Self::Output {
113 fn mul(self, rhs: Self) -> Self::Output {
119 pub trait Add<RHS = Self> {
122 fn add(self, rhs: RHS) -> Self::Output;
128 fn add(self, rhs: Self) -> Self {
136 fn add(self, rhs: Self) -> Self {
144 fn add(self, rhs: Self) -> Self {
152 fn add(self, rhs: Self) -> Self {
160 fn add(self, rhs: Self) -> Self {
166 pub trait Sub<RHS = Self> {
169 fn sub(self, rhs: RHS) -> Self::Output;
175 fn sub(self, rhs: Self) -> Self {
183 fn sub(self, rhs: Self) -> Self {
191 fn sub(self, rhs: Self) -> Self {
199 fn sub(self, rhs: Self) -> Self {
205 pub trait BitOr<RHS = Self> {
209 fn bitor(self, rhs: RHS) -> Self::Output;
212 impl BitOr for bool {
215 fn bitor(self, rhs: bool) -> bool {
220 impl<'a> BitOr<bool> for &'a bool {
223 fn bitor(self, rhs: bool) -> bool {
229 pub trait PartialEq<Rhs: ?Sized = Self> {
230 fn eq(&self, other: &Rhs) -> bool;
231 fn ne(&self, other: &Rhs) -> bool;
234 impl PartialEq for u8 {
235 fn eq(&self, other: &u8) -> bool {
238 fn ne(&self, other: &u8) -> bool {
243 impl PartialEq for u16 {
244 fn eq(&self, other: &u16) -> bool {
247 fn ne(&self, other: &u16) -> bool {
252 impl PartialEq for u32 {
253 fn eq(&self, other: &u32) -> bool {
256 fn ne(&self, other: &u32) -> bool {
262 impl PartialEq for u64 {
263 fn eq(&self, other: &u64) -> bool {
266 fn ne(&self, other: &u64) -> bool {
271 impl PartialEq for usize {
272 fn eq(&self, other: &usize) -> bool {
275 fn ne(&self, other: &usize) -> bool {
280 impl PartialEq for i32 {
281 fn eq(&self, other: &i32) -> bool {
284 fn ne(&self, other: &i32) -> bool {
289 impl PartialEq for i128 {
290 fn eq(&self, other: &i128) -> bool {
293 fn ne(&self, other: &i128) -> bool {
298 impl PartialEq for isize {
299 fn eq(&self, other: &isize) -> bool {
302 fn ne(&self, other: &isize) -> bool {
307 impl PartialEq for char {
308 fn eq(&self, other: &char) -> bool {
311 fn ne(&self, other: &char) -> bool {
316 impl<T: ?Sized> PartialEq for *const T {
317 fn eq(&self, other: &*const T) -> bool {
320 fn ne(&self, other: &*const T) -> bool {
329 fn neg(self) -> Self::Output;
343 fn neg(self) -> i16 {
351 fn neg(self) -> i128 {
359 fn neg(self) -> isize {
371 #[lang = "phantom_data"]
372 pub struct PhantomData<T: ?Sized>;
376 pub trait FnOnce<Args> {
379 extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
384 pub trait FnMut<Args>: FnOnce<Args> {
385 extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
389 // Make it available to jited mini_core_hello_world
390 // FIXME remove next line when jit supports linking rlibs
392 pub fn panic(&(_msg, _file, _line, _col): &(&'static str, &'static str, u32, u32)) -> ! {
394 libc::puts("Panicking\0" as *const str as *const u8);
399 #[lang = "eh_personality"]
400 fn eh_personality() -> ! {
404 #[lang = "drop_in_place"]
405 #[allow(unconditional_recursion)]
406 pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
407 // Code here does not matter - this is replaced by the
408 // real drop glue by the compiler.
409 drop_in_place(to_drop);
416 fn deref(&self) -> &Self::Target;
419 #[lang = "owned_box"]
420 pub struct Box<T: ?Sized>(*mut T);
422 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Box<U>> for Box<T> {}
424 impl<T: ?Sized> Drop for Box<T> {
426 // drop is currently performed by compiler.
430 impl<T> Deref for Box<T> {
433 fn deref(&self) -> &Self::Target {
438 #[lang = "exchange_malloc"]
439 // Make it available to jited mini_core_hello_world
440 // FIXME remove next line when jit supports linking rlibs
442 unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
448 unsafe fn box_free<T: ?Sized>(ptr: *mut T) {
449 libc::free(ptr as *mut u8);
457 pub union MaybeUninit<T> {
463 extern "rust-intrinsic" {
465 pub fn size_of<T>() -> usize;
466 pub fn size_of_val<T: ?::Sized>(val: &T) -> usize;
467 pub fn min_align_of<T>() -> usize;
468 pub fn min_align_of_val<T: ?::Sized>(val: &T) -> usize;
469 pub fn copy<T>(src: *const T, dst: *mut T, count: usize);
470 pub fn transmute<T, U>(e: T) -> U;
471 pub fn init<T>() -> T;
472 pub fn ctlz_nonzero<T>(x: T) -> T;
473 pub fn needs_drop<T>() -> bool;
474 pub fn bitreverse<T>(x: T) -> T;
475 pub fn bswap<T>(x: T) -> T;
476 pub fn unchecked_div<T>(lhs: T, rhs: T) -> T;
483 pub fn puts(s: *const u8);
484 pub fn printf(format: *const i8, ...) -> i32;
485 pub fn malloc(size: usize) -> *mut u8;
486 pub fn free(ptr: *mut u8);
487 pub fn memcpy(dst: *mut u8, src: *const u8, size: usize);
488 pub fn memmove(dst: *mut u8, src: *const u8, size: usize);
489 pub fn strncpy(dst: *mut u8, src: *const u8, size: usize);
494 pub trait Index<Idx: ?Sized> {
496 fn index(&self, index: Idx) -> &Self::Output;
499 impl<T> Index<usize> for [T; 3] {
502 fn index(&self, index: usize) -> &Self::Output {
507 impl<T> Index<usize> for [T] {
510 fn index(&self, index: usize) -> &Self::Output {
521 pub struct VaList<'a>(&'a mut VaListImpl);