2 no_core, lang_items, intrinsics, unboxed_closures, type_ascription, extern_types,
3 untagged_unions, decl_macro, rustc_attrs, transparent_unions, optin_builtin_traits
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 f32 {}
56 unsafe impl Copy for char {}
57 unsafe impl<'a, T: ?Sized> Copy for &'a T {}
58 unsafe impl<T: ?Sized> Copy for *const T {}
59 unsafe impl<T: ?Sized> Copy for *mut T {}
62 pub unsafe trait Sync {}
64 unsafe impl Sync for bool {}
65 unsafe impl Sync for u8 {}
66 unsafe impl Sync for u16 {}
67 unsafe impl Sync for u32 {}
68 unsafe impl Sync for u64 {}
69 unsafe impl Sync for usize {}
70 unsafe impl Sync for i8 {}
71 unsafe impl Sync for i16 {}
72 unsafe impl Sync for i32 {}
73 unsafe impl Sync for isize {}
74 unsafe impl Sync for char {}
75 unsafe impl<'a, T: ?Sized> Sync for &'a T {}
76 unsafe impl Sync for [u8; 16] {}
79 unsafe auto trait Freeze {}
81 unsafe impl<T: ?Sized> Freeze for PhantomData<T> {}
82 unsafe impl<T: ?Sized> Freeze for *const T {}
83 unsafe impl<T: ?Sized> Freeze for *mut T {}
84 unsafe impl<T: ?Sized> Freeze for &T {}
85 unsafe impl<T: ?Sized> Freeze for &mut T {}
91 fn not(self) -> Self::Output;
97 fn not(self) -> bool {
103 pub trait Mul<RHS = Self> {
107 fn mul(self, rhs: RHS) -> Self::Output;
113 fn mul(self, rhs: Self) -> Self::Output {
121 fn mul(self, rhs: Self) -> Self::Output {
127 pub trait Add<RHS = Self> {
130 fn add(self, rhs: RHS) -> Self::Output;
136 fn add(self, rhs: Self) -> Self {
144 fn add(self, rhs: Self) -> Self {
152 fn add(self, rhs: Self) -> Self {
158 pub trait Sub<RHS = Self> {
161 fn sub(self, rhs: RHS) -> Self::Output;
167 fn sub(self, rhs: Self) -> Self {
175 fn sub(self, rhs: Self) -> Self {
183 fn sub(self, rhs: Self) -> Self {
191 fn sub(self, rhs: Self) -> Self {
197 pub trait Rem<RHS = Self> {
200 fn rem(self, rhs: RHS) -> Self::Output;
206 fn rem(self, rhs: Self) -> Self {
212 pub trait BitOr<RHS = Self> {
216 fn bitor(self, rhs: RHS) -> Self::Output;
219 impl BitOr for bool {
222 fn bitor(self, rhs: bool) -> bool {
227 impl<'a> BitOr<bool> for &'a bool {
230 fn bitor(self, rhs: bool) -> bool {
236 pub trait PartialEq<Rhs: ?Sized = Self> {
237 fn eq(&self, other: &Rhs) -> bool;
238 fn ne(&self, other: &Rhs) -> bool;
241 impl PartialEq for u8 {
242 fn eq(&self, other: &u8) -> bool {
245 fn ne(&self, other: &u8) -> bool {
250 impl PartialEq for u16 {
251 fn eq(&self, other: &u16) -> bool {
254 fn ne(&self, other: &u16) -> bool {
259 impl PartialEq for u32 {
260 fn eq(&self, other: &u32) -> bool {
263 fn ne(&self, other: &u32) -> bool {
269 impl PartialEq for u64 {
270 fn eq(&self, other: &u64) -> bool {
273 fn ne(&self, other: &u64) -> bool {
278 impl PartialEq for usize {
279 fn eq(&self, other: &usize) -> bool {
282 fn ne(&self, other: &usize) -> bool {
287 impl PartialEq for i8 {
288 fn eq(&self, other: &i8) -> bool {
291 fn ne(&self, other: &i8) -> bool {
296 impl PartialEq for i32 {
297 fn eq(&self, other: &i32) -> bool {
300 fn ne(&self, other: &i32) -> bool {
305 impl PartialEq for isize {
306 fn eq(&self, other: &isize) -> bool {
309 fn ne(&self, other: &isize) -> bool {
314 impl PartialEq for char {
315 fn eq(&self, other: &char) -> bool {
318 fn ne(&self, other: &char) -> bool {
323 impl<T: ?Sized> PartialEq for *const T {
324 fn eq(&self, other: &*const T) -> bool {
327 fn ne(&self, other: &*const T) -> bool {
336 fn neg(self) -> Self::Output;
350 fn neg(self) -> i16 {
358 fn neg(self) -> isize {
366 fn neg(self) -> f32 {
378 #[lang = "phantom_data"]
379 pub struct PhantomData<T: ?Sized>;
383 pub trait FnOnce<Args> {
386 extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
391 pub trait FnMut<Args>: FnOnce<Args> {
392 extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
396 pub fn panic(&(_msg, _file, _line, _col): &(&'static str, &'static str, u32, u32)) -> ! {
398 libc::puts("Panicking\0" as *const str as *const u8);
403 #[lang = "eh_personality"]
404 fn eh_personality() -> ! {
408 #[lang = "drop_in_place"]
409 #[allow(unconditional_recursion)]
410 pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
411 // Code here does not matter - this is replaced by the
412 // real drop glue by the compiler.
413 drop_in_place(to_drop);
420 fn deref(&self) -> &Self::Target;
423 #[lang = "owned_box"]
424 pub struct Box<T: ?Sized>(*mut T);
426 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Box<U>> for Box<T> {}
428 impl<T: ?Sized> Drop for Box<T> {
430 // drop is currently performed by compiler.
434 impl<T> Deref for Box<T> {
437 fn deref(&self) -> &Self::Target {
442 #[lang = "exchange_malloc"]
443 unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
448 unsafe fn box_free<T: ?Sized>(ptr: *mut T) {
449 libc::free(ptr as *mut u8);
457 #[lang = "manually_drop"]
459 pub struct ManuallyDrop<T: ?Sized> {
463 #[lang = "maybe_uninit"]
465 pub union MaybeUninit<T> {
467 pub value: ManuallyDrop<T>,
471 extern "rust-intrinsic" {
473 pub fn size_of<T>() -> usize;
474 pub fn size_of_val<T: ?::Sized>(val: &T) -> usize;
475 pub fn min_align_of<T>() -> usize;
476 pub fn min_align_of_val<T: ?::Sized>(val: &T) -> usize;
477 pub fn copy<T>(src: *const T, dst: *mut T, count: usize);
478 pub fn transmute<T, U>(e: T) -> U;
479 pub fn init<T>() -> T;
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;
490 pub fn puts(s: *const u8);
491 pub fn printf(format: *const i8, ...) -> i32;
492 pub fn malloc(size: usize) -> *mut u8;
493 pub fn free(ptr: *mut u8);
494 pub fn memcpy(dst: *mut u8, src: *const u8, size: usize);
495 pub fn memmove(dst: *mut u8, src: *const u8, size: usize);
496 pub fn strncpy(dst: *mut u8, src: *const u8, size: usize);
501 pub trait Index<Idx: ?Sized> {
503 fn index(&self, index: Idx) -> &Self::Output;
506 impl<T> Index<usize> for [T; 3] {
509 fn index(&self, index: usize) -> &Self::Output {
514 impl<T> Index<usize> for [T] {
517 fn index(&self, index: usize) -> &Self::Output {
528 pub struct VaList<'a>(&'a mut VaListImpl);
530 #[rustc_builtin_macro]
531 #[rustc_macro_transparency = "semitransparent"]
532 pub macro stringify($($t:tt)*) { /* compiler built-in */ }
534 #[rustc_builtin_macro]
535 #[rustc_macro_transparency = "semitransparent"]
536 pub macro file() { /* compiler built-in */ }
538 #[rustc_builtin_macro]
539 #[rustc_macro_transparency = "semitransparent"]
540 pub macro line() { /* compiler built-in */ }
542 #[rustc_builtin_macro]
543 #[rustc_macro_transparency = "semitransparent"]
544 pub macro cfg() { /* compiler built-in */ }
546 pub static A_STATIC: u8 = 42;
548 #[lang = "panic_location"]
549 struct PanicLocation {