1 #![feature(no_core, lang_items, intrinsics, unboxed_closures, type_ascription)]
9 pub trait Unsize<T: ?Sized> {}
11 #[lang = "coerce_unsized"]
12 pub trait CoerceUnsized<T> {}
14 impl<'a, 'b: 'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<&'a U> for &'b T {}
15 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for *const T {}
16 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<*mut U> for *mut T {}
18 #[lang = "dispatch_from_dyn"]
19 pub trait DispatchFromDyn<T> {}
22 impl<'a, T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<&'a U> for &'a T {}
24 impl<'a, T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<&'a mut U> for &'a mut T {}
25 // *const T -> *const U
26 impl<T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<*const U> for *const T {}
28 impl<T: ?Sized+Unsize<U>, U: ?Sized> DispatchFromDyn<*mut U> for *mut T {}
33 impl<T: ?Sized> Receiver for &T {}
34 impl<T: ?Sized> Receiver for &mut T {}
35 impl<T: ?Sized> Receiver for Box<T> {}
38 pub unsafe trait Copy {}
40 unsafe impl Copy for bool {}
41 unsafe impl Copy for u8 {}
42 unsafe impl Copy for u16 {}
43 unsafe impl Copy for u32 {}
44 unsafe impl Copy for u64 {}
45 unsafe impl Copy for usize {}
46 unsafe impl Copy for i8 {}
47 unsafe impl Copy for i16 {}
48 unsafe impl Copy for i32 {}
49 unsafe impl Copy for isize {}
50 unsafe impl Copy for char {}
51 unsafe impl<'a, T: ?Sized> Copy for &'a T {}
52 unsafe impl<T: ?Sized> Copy for *const T {}
55 pub unsafe trait Sync {}
57 unsafe impl Sync for bool {}
58 unsafe impl Sync for u8 {}
59 unsafe impl Sync for u16 {}
60 unsafe impl Sync for u32 {}
61 unsafe impl Sync for u64 {}
62 unsafe impl Sync for usize {}
63 unsafe impl Sync for i8 {}
64 unsafe impl Sync for i16 {}
65 unsafe impl Sync for i32 {}
66 unsafe impl Sync for isize {}
67 unsafe impl Sync for char {}
68 unsafe impl<'a, T: ?Sized> Sync for &'a T {}
69 unsafe impl Sync for [u8; 16] {}
78 fn not(self) -> Self::Output;
84 fn not(self) -> bool {
90 pub trait Mul<RHS = Self> {
94 fn mul(self, rhs: RHS) -> Self::Output;
100 fn mul(self, rhs: Self) -> Self::Output {
106 pub trait Add<RHS = Self> {
109 fn add(self, rhs: RHS) -> Self::Output;
115 fn add(self, rhs: Self) -> Self {
121 pub trait Sub<RHS = Self> {
124 fn sub(self, rhs: RHS) -> Self::Output;
130 fn sub(self, rhs: Self) -> Self {
136 pub trait BitOr<RHS = Self> {
140 fn bitor(self, rhs: RHS) -> Self::Output;
143 impl BitOr for bool {
146 fn bitor(self, rhs: bool) -> bool {
151 impl<'a> BitOr<bool> for &'a bool {
154 fn bitor(self, rhs: bool) -> bool {
160 pub trait PartialEq<Rhs: ?Sized = Self> {
161 fn eq(&self, other: &Rhs) -> bool;
162 fn ne(&self, other: &Rhs) -> bool;
165 impl PartialEq for u8 {
166 fn eq(&self, other: &u8) -> bool {
169 fn ne(&self, other: &u8) -> bool {
174 impl PartialEq for char {
175 fn eq(&self, other: &char) -> bool {
178 fn ne(&self, other: &char) -> bool {
183 impl<T: ?Sized> PartialEq for *const T {
184 fn eq(&self, other: &*const T) -> bool {
187 fn ne(&self, other: &*const T) -> bool {
196 fn neg(self) -> Self::Output;
202 fn neg(self) -> isize {
214 #[lang = "phantom_data"]
215 pub struct PhantomData<T: ?Sized>;
219 pub trait FnOnce<Args> {
222 extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
227 pub trait FnMut<Args>: FnOnce<Args> {
228 extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
232 pub fn panic(_expr_file_line_col: &(&'static str, &'static str, u32, u32)) -> ! {
238 #[lang = "eh_personality"]
239 fn eh_personality() -> ! {
243 #[lang = "drop_in_place"]
244 #[allow(unconditional_recursion)]
245 pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
246 // Code here does not matter - this is replaced by the
247 // real drop glue by the compiler.
248 drop_in_place(to_drop);
251 #[lang = "owned_box"]
252 pub struct Box<T: ?Sized>(*mut T);
254 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Box<U>> for Box<T> {}
256 static mut MY_TINY_HEAP: [u8; 16] = [0xff; 16];
258 #[lang = "exchange_malloc"]
259 unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
260 &mut MY_TINY_HEAP as *mut [u8; 16] as *mut u8
269 extern "rust-intrinsic" {
271 pub fn size_of<T>() -> usize;
272 pub fn size_of_val<T: ?::Sized>(val: &T) -> usize;
273 pub fn min_align_of<T>() -> usize;
274 pub fn min_align_of_val<T: ?::Sized>(val: &T) -> usize;
275 pub fn copy<T>(src: *const T, dst: *mut T, count: usize);
276 pub fn transmute<T, U>(e: T) -> U;
277 pub fn uninit<T>() -> T;
278 pub fn ctlz_nonzero<T>(x: T) -> T;
279 pub fn needs_drop<T>() -> bool;
284 pub trait Index<Idx: ?Sized> {
286 fn index(&self, index: Idx) -> &Self::Output;
289 impl<T> Index<usize> for [T; 3] {
292 fn index(&self, index: usize) -> &Self::Output {
297 impl<T> Index<usize> for [T] {
300 fn index(&self, index: usize) -> &Self::Output {