2 no_core, lang_items, intrinsics, unboxed_closures, type_ascription, extern_types,
3 untagged_unions, decl_macro, rustc_attrs, transparent_unions, auto_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 u128 {}
52 unsafe impl Copy for usize {}
53 unsafe impl Copy for i8 {}
54 unsafe impl Copy for i16 {}
55 unsafe impl Copy for i32 {}
56 unsafe impl Copy for isize {}
57 unsafe impl Copy for f32 {}
58 unsafe impl Copy for char {}
59 unsafe impl<'a, T: ?Sized> Copy for &'a T {}
60 unsafe impl<T: ?Sized> Copy for *const T {}
61 unsafe impl<T: ?Sized> Copy for *mut T {}
62 unsafe impl<T: Copy> Copy for Option<T> {}
65 pub unsafe trait Sync {}
67 unsafe impl Sync for bool {}
68 unsafe impl Sync for u8 {}
69 unsafe impl Sync for u16 {}
70 unsafe impl Sync for u32 {}
71 unsafe impl Sync for u64 {}
72 unsafe impl Sync for usize {}
73 unsafe impl Sync for i8 {}
74 unsafe impl Sync for i16 {}
75 unsafe impl Sync for i32 {}
76 unsafe impl Sync for isize {}
77 unsafe impl Sync for char {}
78 unsafe impl<'a, T: ?Sized> Sync for &'a T {}
79 unsafe impl Sync for [u8; 16] {}
82 unsafe auto trait Freeze {}
84 unsafe impl<T: ?Sized> Freeze for PhantomData<T> {}
85 unsafe impl<T: ?Sized> Freeze for *const T {}
86 unsafe impl<T: ?Sized> Freeze for *mut T {}
87 unsafe impl<T: ?Sized> Freeze for &T {}
88 unsafe impl<T: ?Sized> Freeze for &mut T {}
90 #[lang = "structural_peq"]
91 pub trait StructuralPartialEq {}
93 #[lang = "structural_teq"]
94 pub trait StructuralEq {}
100 fn not(self) -> Self::Output;
106 fn not(self) -> bool {
112 pub trait Mul<RHS = Self> {
116 fn mul(self, rhs: RHS) -> Self::Output;
122 fn mul(self, rhs: Self) -> Self::Output {
130 fn mul(self, rhs: Self) -> Self::Output {
136 pub trait Add<RHS = Self> {
139 fn add(self, rhs: RHS) -> Self::Output;
145 fn add(self, rhs: Self) -> Self {
153 fn add(self, rhs: Self) -> Self {
161 fn add(self, rhs: Self) -> Self {
167 pub trait Sub<RHS = Self> {
170 fn sub(self, rhs: RHS) -> Self::Output;
176 fn sub(self, rhs: Self) -> Self {
184 fn sub(self, rhs: Self) -> Self {
192 fn sub(self, rhs: Self) -> Self {
200 fn sub(self, rhs: Self) -> Self {
206 pub trait Rem<RHS = Self> {
209 fn rem(self, rhs: RHS) -> Self::Output;
215 fn rem(self, rhs: Self) -> Self {
221 pub trait BitOr<RHS = Self> {
225 fn bitor(self, rhs: RHS) -> Self::Output;
228 impl BitOr for bool {
231 fn bitor(self, rhs: bool) -> bool {
236 impl<'a> BitOr<bool> for &'a bool {
239 fn bitor(self, rhs: bool) -> bool {
245 pub trait PartialEq<Rhs: ?Sized = Self> {
246 fn eq(&self, other: &Rhs) -> bool;
247 fn ne(&self, other: &Rhs) -> bool;
250 impl PartialEq for u8 {
251 fn eq(&self, other: &u8) -> bool {
254 fn ne(&self, other: &u8) -> bool {
259 impl PartialEq for u16 {
260 fn eq(&self, other: &u16) -> bool {
263 fn ne(&self, other: &u16) -> bool {
268 impl PartialEq for u32 {
269 fn eq(&self, other: &u32) -> bool {
272 fn ne(&self, other: &u32) -> bool {
278 impl PartialEq for u64 {
279 fn eq(&self, other: &u64) -> bool {
282 fn ne(&self, other: &u64) -> bool {
287 impl PartialEq for u128 {
288 fn eq(&self, other: &u128) -> bool {
291 fn ne(&self, other: &u128) -> bool {
296 impl PartialEq for usize {
297 fn eq(&self, other: &usize) -> bool {
300 fn ne(&self, other: &usize) -> bool {
305 impl PartialEq for i8 {
306 fn eq(&self, other: &i8) -> bool {
309 fn ne(&self, other: &i8) -> bool {
314 impl PartialEq for i32 {
315 fn eq(&self, other: &i32) -> bool {
318 fn ne(&self, other: &i32) -> bool {
323 impl PartialEq for isize {
324 fn eq(&self, other: &isize) -> bool {
327 fn ne(&self, other: &isize) -> bool {
332 impl PartialEq for char {
333 fn eq(&self, other: &char) -> bool {
336 fn ne(&self, other: &char) -> bool {
341 impl<T: ?Sized> PartialEq for *const T {
342 fn eq(&self, other: &*const T) -> bool {
345 fn ne(&self, other: &*const T) -> bool {
350 impl <T: PartialEq> PartialEq for Option<T> {
351 fn eq(&self, other: &Self) -> bool {
352 match (self, other) {
353 (Some(lhs), Some(rhs)) => *lhs == *rhs,
354 (None, None) => true,
359 fn ne(&self, other: &Self) -> bool {
360 match (self, other) {
361 (Some(lhs), Some(rhs)) => *lhs != *rhs,
362 (None, None) => false,
369 pub trait Shl<RHS = Self> {
373 fn shl(self, rhs: RHS) -> Self::Output;
379 fn shl(self, rhs: u128) -> u128 {
388 fn neg(self) -> Self::Output;
402 fn neg(self) -> i16 {
410 fn neg(self) -> isize {
418 fn neg(self) -> f32 {
430 #[lang = "phantom_data"]
431 pub struct PhantomData<T: ?Sized>;
435 pub trait FnOnce<Args> {
436 #[lang = "fn_once_output"]
439 extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
444 pub trait FnMut<Args>: FnOnce<Args> {
445 extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
450 pub fn panic(_msg: &str) -> ! {
452 libc::puts("Panicking\n\0" as *const str as *const i8);
457 #[lang = "panic_bounds_check"]
459 fn panic_bounds_check(index: usize, len: usize) -> ! {
461 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);
466 #[lang = "eh_personality"]
467 fn eh_personality() -> ! {
471 #[lang = "drop_in_place"]
472 #[allow(unconditional_recursion)]
473 pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
474 // Code here does not matter - this is replaced by the
475 // real drop glue by the compiler.
476 drop_in_place(to_drop);
483 fn deref(&self) -> &Self::Target;
486 #[lang = "owned_box"]
487 pub struct Box<T: ?Sized>(*mut T);
489 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Box<U>> for Box<T> {}
491 impl<T: ?Sized> Drop for Box<T> {
493 // drop is currently performed by compiler.
497 impl<T> Deref for Box<T> {
500 fn deref(&self) -> &Self::Target {
505 #[lang = "exchange_malloc"]
506 unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
511 unsafe fn box_free<T: ?Sized>(ptr: *mut T) {
512 libc::free(ptr as *mut u8);
520 #[lang = "manually_drop"]
522 pub struct ManuallyDrop<T: ?Sized> {
526 #[lang = "maybe_uninit"]
528 pub union MaybeUninit<T> {
530 pub value: ManuallyDrop<T>,
534 extern "rust-intrinsic" {
536 pub fn size_of<T>() -> usize;
537 pub fn size_of_val<T: ?::Sized>(val: *const T) -> usize;
538 pub fn min_align_of<T>() -> usize;
539 pub fn min_align_of_val<T: ?::Sized>(val: *const T) -> usize;
540 pub fn copy<T>(src: *const T, dst: *mut T, count: usize);
541 pub fn transmute<T, U>(e: T) -> U;
542 pub fn ctlz_nonzero<T>(x: T) -> T;
543 pub fn needs_drop<T>() -> bool;
544 pub fn bitreverse<T>(x: T) -> T;
545 pub fn bswap<T>(x: T) -> T;
546 pub fn write_bytes<T>(dst: *mut T, val: u8, count: usize);
551 #[cfg_attr(unix, link(name = "c"))]
552 #[cfg_attr(target_env = "msvc", link(name = "msvcrt"))]
554 pub fn puts(s: *const i8) -> i32;
555 pub fn printf(format: *const i8, ...) -> i32;
556 pub fn malloc(size: usize) -> *mut u8;
557 pub fn free(ptr: *mut u8);
558 pub fn memcpy(dst: *mut u8, src: *const u8, size: usize);
559 pub fn memmove(dst: *mut u8, src: *const u8, size: usize);
560 pub fn strncpy(dst: *mut u8, src: *const u8, size: usize);
565 pub trait Index<Idx: ?Sized> {
567 fn index(&self, index: Idx) -> &Self::Output;
570 impl<T> Index<usize> for [T; 3] {
573 fn index(&self, index: usize) -> &Self::Output {
578 impl<T> Index<usize> for [T] {
581 fn index(&self, index: usize) -> &Self::Output {
592 pub struct VaList<'a>(&'a mut VaListImpl);
594 #[rustc_builtin_macro]
595 #[rustc_macro_transparency = "semitransparent"]
596 pub macro stringify($($t:tt)*) { /* compiler built-in */ }
598 #[rustc_builtin_macro]
599 #[rustc_macro_transparency = "semitransparent"]
600 pub macro file() { /* compiler built-in */ }
602 #[rustc_builtin_macro]
603 #[rustc_macro_transparency = "semitransparent"]
604 pub macro line() { /* compiler built-in */ }
606 #[rustc_builtin_macro]
607 #[rustc_macro_transparency = "semitransparent"]
608 pub macro cfg() { /* compiler built-in */ }
610 #[rustc_builtin_macro]
611 #[rustc_macro_transparency = "semitransparent"]
612 pub macro global_asm() { /* compiler built-in */ }
614 pub static A_STATIC: u8 = 42;
616 #[lang = "panic_location"]
617 struct PanicLocation {
625 pub fn get_tls() -> u8 {