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 usize {}
48 unsafe impl Copy for i8 {}
49 unsafe impl Copy for i16 {}
50 unsafe impl Copy for i32 {}
51 unsafe impl Copy for isize {}
52 unsafe impl Copy for char {}
53 unsafe impl<'a, T: ?Sized> Copy for &'a T {}
54 unsafe impl<T: ?Sized> Copy for *const T {}
55 unsafe impl<T: ?Sized> Copy for *mut T {}
58 pub unsafe trait Sync {}
60 unsafe impl Sync for bool {}
61 unsafe impl Sync for u8 {}
62 unsafe impl Sync for u16 {}
63 unsafe impl Sync for u32 {}
64 unsafe impl Sync for u64 {}
65 unsafe impl Sync for usize {}
66 unsafe impl Sync for i8 {}
67 unsafe impl Sync for i16 {}
68 unsafe impl Sync for i32 {}
69 unsafe impl Sync for isize {}
70 unsafe impl Sync for char {}
71 unsafe impl<'a, T: ?Sized> Sync for &'a T {}
72 unsafe impl Sync for [u8; 16] {}
81 fn not(self) -> Self::Output;
87 fn not(self) -> bool {
93 pub trait Mul<RHS = Self> {
97 fn mul(self, rhs: RHS) -> Self::Output;
103 fn mul(self, rhs: Self) -> Self::Output {
111 fn mul(self, rhs: Self) -> Self::Output {
117 pub trait Add<RHS = Self> {
120 fn add(self, rhs: RHS) -> Self::Output;
126 fn add(self, rhs: Self) -> Self {
134 fn add(self, rhs: Self) -> Self {
142 fn add(self, rhs: Self) -> Self {
148 pub trait Sub<RHS = Self> {
151 fn sub(self, rhs: RHS) -> Self::Output;
157 fn sub(self, rhs: Self) -> Self {
165 fn sub(self, rhs: Self) -> Self {
173 fn sub(self, rhs: Self) -> Self {
181 fn sub(self, rhs: Self) -> Self {
187 pub trait BitOr<RHS = Self> {
191 fn bitor(self, rhs: RHS) -> Self::Output;
194 impl BitOr for bool {
197 fn bitor(self, rhs: bool) -> bool {
202 impl<'a> BitOr<bool> for &'a bool {
205 fn bitor(self, rhs: bool) -> bool {
211 pub trait PartialEq<Rhs: ?Sized = Self> {
212 fn eq(&self, other: &Rhs) -> bool;
213 fn ne(&self, other: &Rhs) -> bool;
216 impl PartialEq for u8 {
217 fn eq(&self, other: &u8) -> bool {
220 fn ne(&self, other: &u8) -> bool {
225 impl PartialEq for u16 {
226 fn eq(&self, other: &u16) -> bool {
229 fn ne(&self, other: &u16) -> bool {
234 impl PartialEq for u32 {
235 fn eq(&self, other: &u32) -> bool {
238 fn ne(&self, other: &u32) -> bool {
244 impl PartialEq for u64 {
245 fn eq(&self, other: &u64) -> bool {
248 fn ne(&self, other: &u64) -> bool {
253 impl PartialEq for usize {
254 fn eq(&self, other: &usize) -> bool {
257 fn ne(&self, other: &usize) -> bool {
262 impl PartialEq for i32 {
263 fn eq(&self, other: &i32) -> bool {
266 fn ne(&self, other: &i32) -> bool {
271 impl PartialEq for isize {
272 fn eq(&self, other: &isize) -> bool {
275 fn ne(&self, other: &isize) -> bool {
280 impl PartialEq for char {
281 fn eq(&self, other: &char) -> bool {
284 fn ne(&self, other: &char) -> bool {
289 impl<T: ?Sized> PartialEq for *const T {
290 fn eq(&self, other: &*const T) -> bool {
293 fn ne(&self, other: &*const T) -> bool {
302 fn neg(self) -> Self::Output;
316 fn neg(self) -> i16 {
324 fn neg(self) -> i128 {
332 fn neg(self) -> isize {
344 #[lang = "phantom_data"]
345 pub struct PhantomData<T: ?Sized>;
349 pub trait FnOnce<Args> {
352 extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
357 pub trait FnMut<Args>: FnOnce<Args> {
358 extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
362 // Make it available to jited mini_core_hello_world
363 // FIXME remove next line when jit supports linking rlibs
365 pub fn panic(&(_msg, _file, _line, _col): &(&'static str, &'static str, u32, u32)) -> ! {
367 libc::puts("Panicking\0" as *const str as *const u8);
372 #[lang = "eh_personality"]
373 fn eh_personality() -> ! {
377 #[lang = "drop_in_place"]
378 #[allow(unconditional_recursion)]
379 pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
380 // Code here does not matter - this is replaced by the
381 // real drop glue by the compiler.
382 drop_in_place(to_drop);
389 fn deref(&self) -> &Self::Target;
392 #[lang = "owned_box"]
393 pub struct Box<T: ?Sized>(*mut T);
395 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Box<U>> for Box<T> {}
397 impl<T: ?Sized> Drop for Box<T> {
399 // drop is currently performed by compiler.
403 impl<T> Deref for Box<T> {
406 fn deref(&self) -> &Self::Target {
411 #[lang = "exchange_malloc"]
412 // Make it available to jited mini_core_hello_world
413 // FIXME remove next line when jit supports linking rlibs
415 unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
421 unsafe fn box_free<T: ?Sized>(ptr: *mut T) {
422 libc::free(ptr as *mut u8);
430 pub union MaybeUninit<T> {
436 extern "rust-intrinsic" {
438 pub fn size_of<T>() -> usize;
439 pub fn size_of_val<T: ?::Sized>(val: &T) -> usize;
440 pub fn min_align_of<T>() -> usize;
441 pub fn min_align_of_val<T: ?::Sized>(val: &T) -> usize;
442 pub fn copy<T>(src: *const T, dst: *mut T, count: usize);
443 pub fn transmute<T, U>(e: T) -> U;
444 pub fn init<T>() -> T;
445 pub fn ctlz_nonzero<T>(x: T) -> T;
446 pub fn needs_drop<T>() -> bool;
447 pub fn bitreverse<T>(x: T) -> T;
448 pub fn bswap<T>(x: T) -> T;
455 pub fn puts(s: *const u8);
456 pub fn printf(format: *const i8, ...) -> i32;
457 pub fn malloc(size: usize) -> *mut u8;
458 pub fn free(ptr: *mut u8);
459 pub fn memcpy(dst: *mut u8, src: *const u8, size: usize);
460 pub fn memmove(dst: *mut u8, src: *const u8, size: usize);
461 pub fn strncpy(dst: *mut u8, src: *const u8, size: usize);
466 pub trait Index<Idx: ?Sized> {
468 fn index(&self, index: Idx) -> &Self::Output;
471 impl<T> Index<usize> for [T; 3] {
474 fn index(&self, index: usize) -> &Self::Output {
479 impl<T> Index<usize> for [T] {
482 fn index(&self, index: usize) -> &Self::Output {
493 pub struct VaList<'a>(&'a mut VaListImpl);