1 #![feature(no_core, lang_items, intrinsics, unboxed_closures)]
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 {}
19 pub unsafe trait Copy {}
21 unsafe impl Copy for bool {}
22 unsafe impl Copy for u8 {}
23 unsafe impl Copy for u16 {}
24 unsafe impl Copy for u32 {}
25 unsafe impl Copy for u64 {}
26 unsafe impl Copy for usize {}
27 unsafe impl Copy for i8 {}
28 unsafe impl Copy for i16 {}
29 unsafe impl Copy for i32 {}
30 unsafe impl Copy for isize {}
31 unsafe impl Copy for char {}
32 unsafe impl<'a, T: ?Sized> Copy for &'a T {}
33 unsafe impl<T: ?Sized> Copy for *const T {}
36 pub unsafe trait Sync {}
38 unsafe impl Sync for bool {}
39 unsafe impl Sync for u8 {}
40 unsafe impl Sync for u16 {}
41 unsafe impl Sync for u32 {}
42 unsafe impl Sync for u64 {}
43 unsafe impl Sync for usize {}
44 unsafe impl Sync for i8 {}
45 unsafe impl Sync for i16 {}
46 unsafe impl Sync for i32 {}
47 unsafe impl Sync for isize {}
48 unsafe impl Sync for char {}
49 unsafe impl<'a, T: ?Sized> Sync for &'a T {}
50 unsafe impl Sync for [u8; 16] {}
59 fn not(self) -> Self::Output;
65 fn not(self) -> bool {
71 pub trait Mul<RHS = Self> {
75 fn mul(self, rhs: RHS) -> Self::Output;
81 fn mul(self, rhs: Self) -> Self::Output {
87 pub trait Add<RHS = Self> {
90 fn add(self, rhs: RHS) -> Self::Output;
96 fn add(self, rhs: Self) -> Self {
102 pub trait Sub<RHS = Self> {
105 fn sub(self, rhs: RHS) -> Self::Output;
111 fn sub(self, rhs: Self) -> Self {
117 pub trait BitOr<RHS = Self> {
121 fn bitor(self, rhs: RHS) -> Self::Output;
124 impl BitOr for bool {
127 fn bitor(self, rhs: bool) -> bool {
132 impl<'a> BitOr<bool> for &'a bool {
135 fn bitor(self, rhs: bool) -> bool {
141 pub trait PartialEq<Rhs: ?Sized = Self> {
142 fn eq(&self, other: &Rhs) -> bool;
143 fn ne(&self, other: &Rhs) -> bool;
146 impl PartialEq for u8 {
147 fn eq(&self, other: &u8) -> bool {
150 fn ne(&self, other: &u8) -> bool {
155 impl PartialEq for char {
156 fn eq(&self, other: &char) -> bool {
159 fn ne(&self, other: &char) -> bool {
164 impl<T: ?Sized> PartialEq for *const T {
165 fn eq(&self, other: &*const T) -> bool {
168 fn ne(&self, other: &*const T) -> bool {
177 fn neg(self) -> Self::Output;
183 fn neg(self) -> isize {
195 #[lang = "phantom_data"]
196 pub struct PhantomData<T: ?Sized>;
200 pub trait FnOnce<Args> {
203 extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
208 pub trait FnMut<Args>: FnOnce<Args> {
209 extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
213 pub fn panic(_expr_file_line_col: &(&'static str, &'static str, u32, u32)) -> ! {
219 #[lang = "eh_personality"]
220 fn eh_personality() -> ! {
224 #[lang = "drop_in_place"]
225 #[allow(unconditional_recursion)]
226 pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
227 // Code here does not matter - this is replaced by the
228 // real drop glue by the compiler.
229 drop_in_place(to_drop);
232 #[lang = "owned_box"]
233 pub struct Box<T: ?Sized>(*mut T);
235 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Box<U>> for Box<T> {}
237 static mut MY_TINY_HEAP: [u8; 16] = [0; 16];
239 #[lang = "exchange_malloc"]
240 unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
241 &mut MY_TINY_HEAP as *mut [u8; 16] as *mut u8
250 extern "rust-intrinsic" {
252 pub fn size_of<T>() -> usize;
253 pub fn size_of_val<T: ?::Sized>(val: &T) -> usize;
254 pub fn min_align_of<T>() -> usize;
255 pub fn min_align_of_val<T: ?::Sized>(val: &T) -> usize;
256 pub fn copy<T>(src: *const T, dst: *mut T, count: usize);
257 pub fn transmute<T, U>(e: T) -> U;
258 pub fn uninit<T>() -> T;
259 pub fn ctlz_nonzero<T>(x: T) -> T;
260 pub fn needs_drop<T>() -> bool;
265 pub trait Index<Idx: ?Sized> {
267 fn index(&self, index: Idx) -> &Self::Output;
270 impl<T> Index<usize> for [T; 3] {
273 fn index(&self, index: usize) -> &Self::Output {
278 impl<T> Index<usize> for [T] {
281 fn index(&self, index: usize) -> &Self::Output {