2 no_core, lang_items, intrinsics, unboxed_closures, type_ascription, extern_types,
3 untagged_unions, decl_macro, rustc_attrs
12 pub trait Unsize<T: ?Sized> {}
14 #[lang = "coerce_unsized"]
15 pub trait CoerceUnsized<T> {}
17 impl<'a, 'b: 'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<&'a U> for &'b T {}
18 impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<&'a mut U> for &'a mut T {}
19 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for *const T {}
20 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*mut U> for *mut T {}
22 #[lang = "dispatch_from_dyn"]
23 pub trait DispatchFromDyn<T> {}
26 impl<'a, T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<&'a U> for &'a T {}
28 impl<'a, T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<&'a mut U> for &'a mut T {}
29 // *const T -> *const U
30 impl<T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<*const U> for *const T {}
32 impl<T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<*mut U> for *mut T {}
33 impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Box<U>> for Box<T> {}
38 impl<T: ?Sized> Receiver for &T {}
39 impl<T: ?Sized> Receiver for &mut T {}
40 impl<T: ?Sized> Receiver for Box<T> {}
43 pub unsafe trait Copy {}
45 unsafe impl Copy for bool {}
46 unsafe impl Copy for u8 {}
47 unsafe impl Copy for u16 {}
48 unsafe impl Copy for u32 {}
49 unsafe impl Copy for u64 {}
50 unsafe impl Copy for usize {}
51 unsafe impl Copy for i8 {}
52 unsafe impl Copy for i16 {}
53 unsafe impl Copy for i32 {}
54 unsafe impl Copy for isize {}
55 unsafe impl Copy for char {}
56 unsafe impl<'a, T: ?Sized> Copy for &'a T {}
57 unsafe impl<T: ?Sized> Copy for *const T {}
58 unsafe impl<T: ?Sized> Copy for *mut T {}
61 pub unsafe trait Sync {}
63 unsafe impl Sync for bool {}
64 unsafe impl Sync for u8 {}
65 unsafe impl Sync for u16 {}
66 unsafe impl Sync for u32 {}
67 unsafe impl Sync for u64 {}
68 unsafe impl Sync for usize {}
69 unsafe impl Sync for i8 {}
70 unsafe impl Sync for i16 {}
71 unsafe impl Sync for i32 {}
72 unsafe impl Sync for isize {}
73 unsafe impl Sync for char {}
74 unsafe impl<'a, T: ?Sized> Sync for &'a T {}
75 unsafe impl Sync for [u8; 16] {}
84 fn not(self) -> Self::Output;
90 fn not(self) -> bool {
96 pub trait Mul<RHS = Self> {
100 fn mul(self, rhs: RHS) -> Self::Output;
106 fn mul(self, rhs: Self) -> Self::Output {
114 fn mul(self, rhs: Self) -> Self::Output {
120 pub trait Add<RHS = Self> {
123 fn add(self, rhs: RHS) -> Self::Output;
129 fn add(self, rhs: Self) -> Self {
137 fn add(self, rhs: Self) -> Self {
145 fn add(self, rhs: Self) -> Self {
151 pub trait Sub<RHS = Self> {
154 fn sub(self, rhs: RHS) -> Self::Output;
160 fn sub(self, rhs: Self) -> Self {
168 fn sub(self, rhs: Self) -> Self {
176 fn sub(self, rhs: Self) -> Self {
184 fn sub(self, rhs: Self) -> Self {
190 pub trait Rem<RHS = Self> {
193 fn rem(self, rhs: RHS) -> Self::Output;
199 fn rem(self, rhs: Self) -> Self {
205 pub trait BitOr<RHS = Self> {
209 fn bitor(self, rhs: RHS) -> Self::Output;
212 impl BitOr for bool {
215 fn bitor(self, rhs: bool) -> bool {
220 impl<'a> BitOr<bool> for &'a bool {
223 fn bitor(self, rhs: bool) -> bool {
229 pub trait PartialEq<Rhs: ?Sized = Self> {
230 fn eq(&self, other: &Rhs) -> bool;
231 fn ne(&self, other: &Rhs) -> bool;
234 impl PartialEq for u8 {
235 fn eq(&self, other: &u8) -> bool {
238 fn ne(&self, other: &u8) -> bool {
243 impl PartialEq for u16 {
244 fn eq(&self, other: &u16) -> bool {
247 fn ne(&self, other: &u16) -> bool {
252 impl PartialEq for u32 {
253 fn eq(&self, other: &u32) -> bool {
256 fn ne(&self, other: &u32) -> bool {
262 impl PartialEq for u64 {
263 fn eq(&self, other: &u64) -> bool {
266 fn ne(&self, other: &u64) -> bool {
271 impl PartialEq for usize {
272 fn eq(&self, other: &usize) -> bool {
275 fn ne(&self, other: &usize) -> bool {
280 impl PartialEq for i32 {
281 fn eq(&self, other: &i32) -> bool {
284 fn ne(&self, other: &i32) -> bool {
289 impl PartialEq for isize {
290 fn eq(&self, other: &isize) -> bool {
293 fn ne(&self, other: &isize) -> bool {
298 impl PartialEq for char {
299 fn eq(&self, other: &char) -> bool {
302 fn ne(&self, other: &char) -> bool {
307 impl<T: ?Sized> PartialEq for *const T {
308 fn eq(&self, other: &*const T) -> bool {
311 fn ne(&self, other: &*const T) -> bool {
320 fn neg(self) -> Self::Output;
334 fn neg(self) -> i16 {
342 fn neg(self) -> isize {
354 #[lang = "phantom_data"]
355 pub struct PhantomData<T: ?Sized>;
359 pub trait FnOnce<Args> {
362 extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
367 pub trait FnMut<Args>: FnOnce<Args> {
368 extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
372 pub fn panic(&(_msg, _file, _line, _col): &(&'static str, &'static str, u32, u32)) -> ! {
374 libc::puts("Panicking\0" as *const str as *const u8);
379 #[lang = "eh_personality"]
380 fn eh_personality() -> ! {
384 #[lang = "drop_in_place"]
385 #[allow(unconditional_recursion)]
386 pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
387 // Code here does not matter - this is replaced by the
388 // real drop glue by the compiler.
389 drop_in_place(to_drop);
396 fn deref(&self) -> &Self::Target;
399 #[lang = "owned_box"]
400 pub struct Box<T: ?Sized>(*mut T);
402 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Box<U>> for Box<T> {}
404 impl<T: ?Sized> Drop for Box<T> {
406 // drop is currently performed by compiler.
410 impl<T> Deref for Box<T> {
413 fn deref(&self) -> &Self::Target {
418 #[lang = "exchange_malloc"]
419 unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
424 unsafe fn box_free<T: ?Sized>(ptr: *mut T) {
425 libc::free(ptr as *mut u8);
433 #[allow(unions_with_drop_fields)]
434 pub union MaybeUninit<T> {
440 extern "rust-intrinsic" {
442 pub fn size_of<T>() -> usize;
443 pub fn size_of_val<T: ?::Sized>(val: &T) -> usize;
444 pub fn min_align_of<T>() -> usize;
445 pub fn min_align_of_val<T: ?::Sized>(val: &T) -> usize;
446 pub fn copy<T>(src: *const T, dst: *mut T, count: usize);
447 pub fn transmute<T, U>(e: T) -> U;
448 pub fn init<T>() -> T;
449 pub fn ctlz_nonzero<T>(x: T) -> T;
450 pub fn needs_drop<T>() -> bool;
451 pub fn bitreverse<T>(x: T) -> T;
452 pub fn bswap<T>(x: T) -> T;
459 pub fn puts(s: *const u8);
460 pub fn printf(format: *const i8, ...) -> i32;
461 pub fn malloc(size: usize) -> *mut u8;
462 pub fn free(ptr: *mut u8);
463 pub fn memcpy(dst: *mut u8, src: *const u8, size: usize);
464 pub fn memmove(dst: *mut u8, src: *const u8, size: usize);
465 pub fn strncpy(dst: *mut u8, src: *const u8, size: usize);
470 pub trait Index<Idx: ?Sized> {
472 fn index(&self, index: Idx) -> &Self::Output;
475 impl<T> Index<usize> for [T; 3] {
478 fn index(&self, index: usize) -> &Self::Output {
483 impl<T> Index<usize> for [T] {
486 fn index(&self, index: usize) -> &Self::Output {
497 pub struct VaList<'a>(&'a mut VaListImpl);
499 #[rustc_builtin_macro]
500 #[rustc_macro_transparency = "semitransparent"]
501 pub macro stringify($($t:tt)*) { /* compiler built-in */ }
503 #[rustc_builtin_macro]
504 #[rustc_macro_transparency = "semitransparent"]
505 pub macro file() { /* compiler built-in */ }
507 #[rustc_builtin_macro]
508 #[rustc_macro_transparency = "semitransparent"]
509 pub macro line() { /* compiler built-in */ }