2 no_core, lang_items, intrinsics, unboxed_closures, type_ascription, extern_types,
3 untagged_unions, decl_macro, rustc_attrs, transparent_unions, optin_builtin_traits,
4 thread_local, track_caller
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 {}
63 pub unsafe trait Sync {}
65 unsafe impl Sync for bool {}
66 unsafe impl Sync for u8 {}
67 unsafe impl Sync for u16 {}
68 unsafe impl Sync for u32 {}
69 unsafe impl Sync for u64 {}
70 unsafe impl Sync for usize {}
71 unsafe impl Sync for i8 {}
72 unsafe impl Sync for i16 {}
73 unsafe impl Sync for i32 {}
74 unsafe impl Sync for isize {}
75 unsafe impl Sync for char {}
76 unsafe impl<'a, T: ?Sized> Sync for &'a T {}
77 unsafe impl Sync for [u8; 16] {}
80 unsafe auto trait Freeze {}
82 unsafe impl<T: ?Sized> Freeze for PhantomData<T> {}
83 unsafe impl<T: ?Sized> Freeze for *const T {}
84 unsafe impl<T: ?Sized> Freeze for *mut T {}
85 unsafe impl<T: ?Sized> Freeze for &T {}
86 unsafe impl<T: ?Sized> Freeze for &mut T {}
88 #[lang = "structural_peq"]
89 pub trait StructuralPartialEq {}
91 #[lang = "structural_teq"]
92 pub trait StructuralEq {}
98 fn not(self) -> Self::Output;
104 fn not(self) -> bool {
110 pub trait Mul<RHS = Self> {
114 fn mul(self, rhs: RHS) -> Self::Output;
120 fn mul(self, rhs: Self) -> Self::Output {
128 fn mul(self, rhs: Self) -> Self::Output {
134 pub trait Add<RHS = Self> {
137 fn add(self, rhs: RHS) -> Self::Output;
143 fn add(self, rhs: Self) -> Self {
151 fn add(self, rhs: Self) -> Self {
159 fn add(self, rhs: Self) -> Self {
165 pub trait Sub<RHS = Self> {
168 fn sub(self, rhs: RHS) -> Self::Output;
174 fn sub(self, rhs: Self) -> Self {
182 fn sub(self, rhs: Self) -> Self {
190 fn sub(self, rhs: Self) -> Self {
198 fn sub(self, rhs: Self) -> Self {
204 pub trait Rem<RHS = Self> {
207 fn rem(self, rhs: RHS) -> Self::Output;
213 fn rem(self, rhs: Self) -> Self {
219 pub trait BitOr<RHS = Self> {
223 fn bitor(self, rhs: RHS) -> Self::Output;
226 impl BitOr for bool {
229 fn bitor(self, rhs: bool) -> bool {
234 impl<'a> BitOr<bool> for &'a bool {
237 fn bitor(self, rhs: bool) -> bool {
243 pub trait PartialEq<Rhs: ?Sized = Self> {
244 fn eq(&self, other: &Rhs) -> bool;
245 fn ne(&self, other: &Rhs) -> bool;
248 impl PartialEq for u8 {
249 fn eq(&self, other: &u8) -> bool {
252 fn ne(&self, other: &u8) -> bool {
257 impl PartialEq for u16 {
258 fn eq(&self, other: &u16) -> bool {
261 fn ne(&self, other: &u16) -> bool {
266 impl PartialEq for u32 {
267 fn eq(&self, other: &u32) -> bool {
270 fn ne(&self, other: &u32) -> bool {
276 impl PartialEq for u64 {
277 fn eq(&self, other: &u64) -> bool {
280 fn ne(&self, other: &u64) -> bool {
285 impl PartialEq for usize {
286 fn eq(&self, other: &usize) -> bool {
289 fn ne(&self, other: &usize) -> bool {
294 impl PartialEq for i8 {
295 fn eq(&self, other: &i8) -> bool {
298 fn ne(&self, other: &i8) -> bool {
303 impl PartialEq for i32 {
304 fn eq(&self, other: &i32) -> bool {
307 fn ne(&self, other: &i32) -> bool {
312 impl PartialEq for isize {
313 fn eq(&self, other: &isize) -> bool {
316 fn ne(&self, other: &isize) -> bool {
321 impl PartialEq for char {
322 fn eq(&self, other: &char) -> bool {
325 fn ne(&self, other: &char) -> bool {
330 impl<T: ?Sized> PartialEq for *const T {
331 fn eq(&self, other: &*const T) -> bool {
334 fn ne(&self, other: &*const T) -> bool {
343 fn neg(self) -> Self::Output;
357 fn neg(self) -> i16 {
365 fn neg(self) -> isize {
373 fn neg(self) -> f32 {
385 #[lang = "phantom_data"]
386 pub struct PhantomData<T: ?Sized>;
390 pub trait FnOnce<Args> {
393 extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
398 pub trait FnMut<Args>: FnOnce<Args> {
399 extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
404 pub fn panic(_msg: &str) -> ! {
406 libc::puts("Panicking\n\0" as *const str as *const i8);
411 #[lang = "panic_bounds_check"]
413 fn panic_bounds_check(index: usize, len: usize) -> ! {
415 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);
420 #[lang = "eh_personality"]
421 fn eh_personality() -> ! {
425 #[lang = "drop_in_place"]
426 #[allow(unconditional_recursion)]
427 pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
428 // Code here does not matter - this is replaced by the
429 // real drop glue by the compiler.
430 drop_in_place(to_drop);
437 fn deref(&self) -> &Self::Target;
440 #[lang = "owned_box"]
441 pub struct Box<T: ?Sized>(*mut T);
443 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Box<U>> for Box<T> {}
445 impl<T: ?Sized> Drop for Box<T> {
447 // drop is currently performed by compiler.
451 impl<T> Deref for Box<T> {
454 fn deref(&self) -> &Self::Target {
459 #[lang = "exchange_malloc"]
460 unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
465 unsafe fn box_free<T: ?Sized>(ptr: *mut T) {
466 libc::free(ptr as *mut u8);
474 #[lang = "manually_drop"]
476 pub struct ManuallyDrop<T: ?Sized> {
480 #[lang = "maybe_uninit"]
482 pub union MaybeUninit<T> {
484 pub value: ManuallyDrop<T>,
488 extern "rust-intrinsic" {
490 pub fn size_of<T>() -> usize;
491 pub fn size_of_val<T: ?::Sized>(val: *const T) -> usize;
492 pub fn min_align_of<T>() -> usize;
493 pub fn min_align_of_val<T: ?::Sized>(val: *const T) -> usize;
494 pub fn copy<T>(src: *const T, dst: *mut T, count: usize);
495 pub fn transmute<T, U>(e: T) -> U;
496 pub fn ctlz_nonzero<T>(x: T) -> T;
497 pub fn needs_drop<T>() -> bool;
498 pub fn bitreverse<T>(x: T) -> T;
499 pub fn bswap<T>(x: T) -> T;
500 pub fn write_bytes<T>(dst: *mut T, val: u8, count: usize);
505 #[cfg_attr(not(windows), link(name = "c"))]
506 #[cfg_attr(windows, link(name = "msvcrt"))]
508 pub fn puts(s: *const i8) -> i32;
509 pub fn printf(format: *const i8, ...) -> i32;
510 pub fn malloc(size: usize) -> *mut u8;
511 pub fn free(ptr: *mut u8);
512 pub fn memcpy(dst: *mut u8, src: *const u8, size: usize);
513 pub fn memmove(dst: *mut u8, src: *const u8, size: usize);
514 pub fn strncpy(dst: *mut u8, src: *const u8, size: usize);
519 pub trait Index<Idx: ?Sized> {
521 fn index(&self, index: Idx) -> &Self::Output;
524 impl<T> Index<usize> for [T; 3] {
527 fn index(&self, index: usize) -> &Self::Output {
532 impl<T> Index<usize> for [T] {
535 fn index(&self, index: usize) -> &Self::Output {
546 pub struct VaList<'a>(&'a mut VaListImpl);
548 #[rustc_builtin_macro]
549 #[rustc_macro_transparency = "semitransparent"]
550 pub macro stringify($($t:tt)*) { /* compiler built-in */ }
552 #[rustc_builtin_macro]
553 #[rustc_macro_transparency = "semitransparent"]
554 pub macro file() { /* compiler built-in */ }
556 #[rustc_builtin_macro]
557 #[rustc_macro_transparency = "semitransparent"]
558 pub macro line() { /* compiler built-in */ }
560 #[rustc_builtin_macro]
561 #[rustc_macro_transparency = "semitransparent"]
562 pub macro cfg() { /* compiler built-in */ }
564 pub static A_STATIC: u8 = 42;
566 #[lang = "panic_location"]
567 struct PanicLocation {
574 pub fn get_tls() -> u8 {