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 {}
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 {}
92 fn not(self) -> Self::Output;
98 fn not(self) -> bool {
104 pub trait Mul<RHS = Self> {
108 fn mul(self, rhs: RHS) -> Self::Output;
114 fn mul(self, rhs: Self) -> Self::Output {
122 fn mul(self, rhs: Self) -> Self::Output {
128 pub trait Add<RHS = Self> {
131 fn add(self, rhs: RHS) -> Self::Output;
137 fn add(self, rhs: Self) -> Self {
145 fn add(self, rhs: Self) -> Self {
153 fn add(self, rhs: Self) -> Self {
159 pub trait Sub<RHS = Self> {
162 fn sub(self, rhs: RHS) -> Self::Output;
168 fn sub(self, rhs: Self) -> Self {
176 fn sub(self, rhs: Self) -> Self {
184 fn sub(self, rhs: Self) -> Self {
192 fn sub(self, rhs: Self) -> Self {
198 pub trait Rem<RHS = Self> {
201 fn rem(self, rhs: RHS) -> Self::Output;
207 fn rem(self, rhs: Self) -> Self {
213 pub trait BitOr<RHS = Self> {
217 fn bitor(self, rhs: RHS) -> Self::Output;
220 impl BitOr for bool {
223 fn bitor(self, rhs: bool) -> bool {
228 impl<'a> BitOr<bool> for &'a bool {
231 fn bitor(self, rhs: bool) -> bool {
237 pub trait PartialEq<Rhs: ?Sized = Self> {
238 fn eq(&self, other: &Rhs) -> bool;
239 fn ne(&self, other: &Rhs) -> bool;
242 impl PartialEq for u8 {
243 fn eq(&self, other: &u8) -> bool {
246 fn ne(&self, other: &u8) -> bool {
251 impl PartialEq for u16 {
252 fn eq(&self, other: &u16) -> bool {
255 fn ne(&self, other: &u16) -> bool {
260 impl PartialEq for u32 {
261 fn eq(&self, other: &u32) -> bool {
264 fn ne(&self, other: &u32) -> bool {
270 impl PartialEq for u64 {
271 fn eq(&self, other: &u64) -> bool {
274 fn ne(&self, other: &u64) -> bool {
279 impl PartialEq for usize {
280 fn eq(&self, other: &usize) -> bool {
283 fn ne(&self, other: &usize) -> bool {
288 impl PartialEq for i8 {
289 fn eq(&self, other: &i8) -> bool {
292 fn ne(&self, other: &i8) -> bool {
297 impl PartialEq for i32 {
298 fn eq(&self, other: &i32) -> bool {
301 fn ne(&self, other: &i32) -> bool {
306 impl PartialEq for isize {
307 fn eq(&self, other: &isize) -> bool {
310 fn ne(&self, other: &isize) -> bool {
315 impl PartialEq for char {
316 fn eq(&self, other: &char) -> bool {
319 fn ne(&self, other: &char) -> bool {
324 impl<T: ?Sized> PartialEq for *const T {
325 fn eq(&self, other: &*const T) -> bool {
328 fn ne(&self, other: &*const T) -> bool {
337 fn neg(self) -> Self::Output;
351 fn neg(self) -> i16 {
359 fn neg(self) -> isize {
367 fn neg(self) -> f32 {
379 #[lang = "phantom_data"]
380 pub struct PhantomData<T: ?Sized>;
384 pub trait FnOnce<Args> {
387 extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
392 pub trait FnMut<Args>: FnOnce<Args> {
393 extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
397 pub fn panic(&(_msg, _file, _line, _col): &(&'static str, &'static str, u32, u32)) -> ! {
399 libc::puts("Panicking\0" as *const str as *const u8);
404 #[lang = "eh_personality"]
405 fn eh_personality() -> ! {
409 #[lang = "drop_in_place"]
410 #[allow(unconditional_recursion)]
411 pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
412 // Code here does not matter - this is replaced by the
413 // real drop glue by the compiler.
414 drop_in_place(to_drop);
421 fn deref(&self) -> &Self::Target;
424 #[lang = "owned_box"]
425 pub struct Box<T: ?Sized>(*mut T);
427 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Box<U>> for Box<T> {}
429 impl<T: ?Sized> Drop for Box<T> {
431 // drop is currently performed by compiler.
435 impl<T> Deref for Box<T> {
438 fn deref(&self) -> &Self::Target {
443 #[lang = "exchange_malloc"]
444 unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
449 unsafe fn box_free<T: ?Sized>(ptr: *mut T) {
450 libc::free(ptr as *mut u8);
458 #[lang = "manually_drop"]
460 pub struct ManuallyDrop<T: ?Sized> {
464 #[lang = "maybe_uninit"]
466 pub union MaybeUninit<T> {
468 pub value: ManuallyDrop<T>,
472 extern "rust-intrinsic" {
474 pub fn size_of<T>() -> usize;
475 pub fn size_of_val<T: ?::Sized>(val: *const T) -> usize;
476 pub fn min_align_of<T>() -> usize;
477 pub fn min_align_of_val<T: ?::Sized>(val: *const T) -> usize;
478 pub fn copy<T>(src: *const T, dst: *mut T, count: usize);
479 pub fn transmute<T, U>(e: T) -> U;
480 pub fn ctlz_nonzero<T>(x: T) -> T;
481 pub fn needs_drop<T>() -> bool;
482 pub fn bitreverse<T>(x: T) -> T;
483 pub fn bswap<T>(x: T) -> T;
484 pub fn write_bytes<T>(dst: *mut T, val: u8, count: usize);
491 pub fn puts(s: *const u8);
492 pub fn printf(format: *const i8, ...) -> i32;
493 pub fn malloc(size: usize) -> *mut u8;
494 pub fn free(ptr: *mut u8);
495 pub fn memcpy(dst: *mut u8, src: *const u8, size: usize);
496 pub fn memmove(dst: *mut u8, src: *const u8, size: usize);
497 pub fn strncpy(dst: *mut u8, src: *const u8, size: usize);
502 pub trait Index<Idx: ?Sized> {
504 fn index(&self, index: Idx) -> &Self::Output;
507 impl<T> Index<usize> for [T; 3] {
510 fn index(&self, index: usize) -> &Self::Output {
515 impl<T> Index<usize> for [T] {
518 fn index(&self, index: usize) -> &Self::Output {
529 pub struct VaList<'a>(&'a mut VaListImpl);
531 #[rustc_builtin_macro]
532 #[rustc_macro_transparency = "semitransparent"]
533 pub macro stringify($($t:tt)*) { /* compiler built-in */ }
535 #[rustc_builtin_macro]
536 #[rustc_macro_transparency = "semitransparent"]
537 pub macro file() { /* compiler built-in */ }
539 #[rustc_builtin_macro]
540 #[rustc_macro_transparency = "semitransparent"]
541 pub macro line() { /* compiler built-in */ }
543 #[rustc_builtin_macro]
544 #[rustc_macro_transparency = "semitransparent"]
545 pub macro cfg() { /* compiler built-in */ }
547 pub static A_STATIC: u8 = 42;
549 #[lang = "panic_location"]
550 struct PanicLocation {
557 pub fn get_tls() -> u8 {