2 no_core, lang_items, intrinsics, unboxed_closures, type_ascription, extern_types,
3 untagged_unions, decl_macro, rustc_attrs, transparent_unions, optin_builtin_traits,
13 pub trait Unsize<T: ?Sized> {}
15 #[lang = "coerce_unsized"]
16 pub trait CoerceUnsized<T> {}
18 impl<'a, 'b: 'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<&'a U> for &'b T {}
19 impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<&'a mut U> for &'a mut T {}
20 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for *const T {}
21 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*mut U> for *mut T {}
23 #[lang = "dispatch_from_dyn"]
24 pub trait DispatchFromDyn<T> {}
27 impl<'a, T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<&'a U> for &'a T {}
29 impl<'a, T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<&'a mut U> for &'a mut T {}
30 // *const T -> *const U
31 impl<T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<*const U> for *const T {}
33 impl<T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<*mut U> for *mut T {}
34 impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Box<U>> for Box<T> {}
39 impl<T: ?Sized> Receiver for &T {}
40 impl<T: ?Sized> Receiver for &mut T {}
41 impl<T: ?Sized> Receiver for Box<T> {}
44 pub unsafe trait Copy {}
46 unsafe impl Copy for bool {}
47 unsafe impl Copy for u8 {}
48 unsafe impl Copy for u16 {}
49 unsafe impl Copy for u32 {}
50 unsafe impl Copy for u64 {}
51 unsafe impl Copy for usize {}
52 unsafe impl Copy for i8 {}
53 unsafe impl Copy for i16 {}
54 unsafe impl Copy for i32 {}
55 unsafe impl Copy for isize {}
56 unsafe impl Copy for f32 {}
57 unsafe impl Copy for char {}
58 unsafe impl<'a, T: ?Sized> Copy for &'a T {}
59 unsafe impl<T: ?Sized> Copy for *const T {}
60 unsafe impl<T: ?Sized> Copy for *mut T {}
61 unsafe impl<T: Copy> Copy for Option<T> {}
64 pub unsafe trait Sync {}
66 unsafe impl Sync for bool {}
67 unsafe impl Sync for u8 {}
68 unsafe impl Sync for u16 {}
69 unsafe impl Sync for u32 {}
70 unsafe impl Sync for u64 {}
71 unsafe impl Sync for usize {}
72 unsafe impl Sync for i8 {}
73 unsafe impl Sync for i16 {}
74 unsafe impl Sync for i32 {}
75 unsafe impl Sync for isize {}
76 unsafe impl Sync for char {}
77 unsafe impl<'a, T: ?Sized> Sync for &'a T {}
78 unsafe impl Sync for [u8; 16] {}
81 unsafe auto trait Freeze {}
83 unsafe impl<T: ?Sized> Freeze for PhantomData<T> {}
84 unsafe impl<T: ?Sized> Freeze for *const T {}
85 unsafe impl<T: ?Sized> Freeze for *mut T {}
86 unsafe impl<T: ?Sized> Freeze for &T {}
87 unsafe impl<T: ?Sized> Freeze for &mut T {}
89 #[lang = "structural_peq"]
90 pub trait StructuralPartialEq {}
92 #[lang = "structural_teq"]
93 pub trait StructuralEq {}
99 fn not(self) -> Self::Output;
105 fn not(self) -> bool {
111 pub trait Mul<RHS = Self> {
115 fn mul(self, rhs: RHS) -> Self::Output;
121 fn mul(self, rhs: Self) -> Self::Output {
129 fn mul(self, rhs: Self) -> Self::Output {
135 pub trait Add<RHS = Self> {
138 fn add(self, rhs: RHS) -> Self::Output;
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 Rem<RHS = Self> {
208 fn rem(self, rhs: RHS) -> Self::Output;
214 fn rem(self, rhs: Self) -> Self {
220 pub trait BitOr<RHS = Self> {
224 fn bitor(self, rhs: RHS) -> Self::Output;
227 impl BitOr for bool {
230 fn bitor(self, rhs: bool) -> bool {
235 impl<'a> BitOr<bool> for &'a bool {
238 fn bitor(self, rhs: bool) -> bool {
244 pub trait PartialEq<Rhs: ?Sized = Self> {
245 fn eq(&self, other: &Rhs) -> bool;
246 fn ne(&self, other: &Rhs) -> bool;
249 impl PartialEq for u8 {
250 fn eq(&self, other: &u8) -> bool {
253 fn ne(&self, other: &u8) -> bool {
258 impl PartialEq for u16 {
259 fn eq(&self, other: &u16) -> bool {
262 fn ne(&self, other: &u16) -> bool {
267 impl PartialEq for u32 {
268 fn eq(&self, other: &u32) -> bool {
271 fn ne(&self, other: &u32) -> bool {
277 impl PartialEq for u64 {
278 fn eq(&self, other: &u64) -> bool {
281 fn ne(&self, other: &u64) -> bool {
286 impl PartialEq for usize {
287 fn eq(&self, other: &usize) -> bool {
290 fn ne(&self, other: &usize) -> bool {
295 impl PartialEq for i8 {
296 fn eq(&self, other: &i8) -> bool {
299 fn ne(&self, other: &i8) -> bool {
304 impl PartialEq for i32 {
305 fn eq(&self, other: &i32) -> bool {
308 fn ne(&self, other: &i32) -> bool {
313 impl PartialEq for isize {
314 fn eq(&self, other: &isize) -> bool {
317 fn ne(&self, other: &isize) -> bool {
322 impl PartialEq for char {
323 fn eq(&self, other: &char) -> bool {
326 fn ne(&self, other: &char) -> bool {
331 impl<T: ?Sized> PartialEq for *const T {
332 fn eq(&self, other: &*const T) -> bool {
335 fn ne(&self, other: &*const T) -> bool {
340 impl <T: PartialEq> PartialEq for Option<T> {
341 fn eq(&self, other: &Self) -> bool {
342 match (self, other) {
343 (Some(lhs), Some(rhs)) => *lhs == *rhs,
344 (None, None) => true,
349 fn ne(&self, other: &Self) -> bool {
350 match (self, other) {
351 (Some(lhs), Some(rhs)) => *lhs != *rhs,
352 (None, None) => false,
362 fn neg(self) -> Self::Output;
376 fn neg(self) -> i16 {
384 fn neg(self) -> isize {
392 fn neg(self) -> f32 {
404 #[lang = "phantom_data"]
405 pub struct PhantomData<T: ?Sized>;
409 pub trait FnOnce<Args> {
410 #[lang = "fn_once_output"]
413 extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
418 pub trait FnMut<Args>: FnOnce<Args> {
419 extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
424 pub fn panic(_msg: &str) -> ! {
426 libc::puts("Panicking\n\0" as *const str as *const i8);
431 #[lang = "panic_bounds_check"]
433 fn panic_bounds_check(index: usize, len: usize) -> ! {
435 libc::printf("index out of bounds: the len is %d but the index is %d\n\0" as *const str as *const i8, len, index);
440 #[lang = "eh_personality"]
441 fn eh_personality() -> ! {
445 #[lang = "drop_in_place"]
446 #[allow(unconditional_recursion)]
447 pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
448 // Code here does not matter - this is replaced by the
449 // real drop glue by the compiler.
450 drop_in_place(to_drop);
457 fn deref(&self) -> &Self::Target;
460 #[lang = "owned_box"]
461 pub struct Box<T: ?Sized>(*mut T);
463 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Box<U>> for Box<T> {}
465 impl<T: ?Sized> Drop for Box<T> {
467 // drop is currently performed by compiler.
471 impl<T> Deref for Box<T> {
474 fn deref(&self) -> &Self::Target {
479 #[lang = "exchange_malloc"]
480 unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
485 unsafe fn box_free<T: ?Sized>(ptr: *mut T) {
486 libc::free(ptr as *mut u8);
494 #[lang = "manually_drop"]
496 pub struct ManuallyDrop<T: ?Sized> {
500 #[lang = "maybe_uninit"]
502 pub union MaybeUninit<T> {
504 pub value: ManuallyDrop<T>,
508 extern "rust-intrinsic" {
510 pub fn size_of<T>() -> usize;
511 pub fn size_of_val<T: ?::Sized>(val: *const T) -> usize;
512 pub fn min_align_of<T>() -> usize;
513 pub fn min_align_of_val<T: ?::Sized>(val: *const T) -> usize;
514 pub fn copy<T>(src: *const T, dst: *mut T, count: usize);
515 pub fn transmute<T, U>(e: T) -> U;
516 pub fn ctlz_nonzero<T>(x: T) -> T;
517 pub fn needs_drop<T>() -> bool;
518 pub fn bitreverse<T>(x: T) -> T;
519 pub fn bswap<T>(x: T) -> T;
520 pub fn write_bytes<T>(dst: *mut T, val: u8, count: usize);
525 #[cfg_attr(not(windows), link(name = "c"))]
526 #[cfg_attr(windows, link(name = "msvcrt"))]
528 pub fn puts(s: *const i8) -> i32;
529 pub fn printf(format: *const i8, ...) -> i32;
530 pub fn malloc(size: usize) -> *mut u8;
531 pub fn free(ptr: *mut u8);
532 pub fn memcpy(dst: *mut u8, src: *const u8, size: usize);
533 pub fn memmove(dst: *mut u8, src: *const u8, size: usize);
534 pub fn strncpy(dst: *mut u8, src: *const u8, size: usize);
539 pub trait Index<Idx: ?Sized> {
541 fn index(&self, index: Idx) -> &Self::Output;
544 impl<T> Index<usize> for [T; 3] {
547 fn index(&self, index: usize) -> &Self::Output {
552 impl<T> Index<usize> for [T] {
555 fn index(&self, index: usize) -> &Self::Output {
566 pub struct VaList<'a>(&'a mut VaListImpl);
568 #[rustc_builtin_macro]
569 #[rustc_macro_transparency = "semitransparent"]
570 pub macro stringify($($t:tt)*) { /* compiler built-in */ }
572 #[rustc_builtin_macro]
573 #[rustc_macro_transparency = "semitransparent"]
574 pub macro file() { /* compiler built-in */ }
576 #[rustc_builtin_macro]
577 #[rustc_macro_transparency = "semitransparent"]
578 pub macro line() { /* compiler built-in */ }
580 #[rustc_builtin_macro]
581 #[rustc_macro_transparency = "semitransparent"]
582 pub macro cfg() { /* compiler built-in */ }
584 #[rustc_builtin_macro]
585 #[rustc_macro_transparency = "semitransparent"]
586 pub macro global_asm() { /* compiler built-in */ }
588 pub static A_STATIC: u8 = 42;
590 #[lang = "panic_location"]
591 struct PanicLocation {
598 pub fn get_tls() -> u8 {