8 #![feature(arbitrary_self_types, auto_traits, lang_items, no_core, start, intrinsics)]
17 // Because we don't have core yet.
25 impl Copy for isize {}
26 impl Copy for usize {}
42 pub(crate) unsafe auto trait Freeze {}
47 pub fn printf(format: *const i8, ...) -> i32;
48 pub fn puts(s: *const u8) -> i32;
53 pub trait Index<Idx: ?Sized> {
55 fn index(&self, index: Idx) -> &Self::Output;
58 impl<T> Index<usize> for [T; 3] {
61 fn index(&self, index: usize) -> &Self::Output {
66 impl<T> Index<usize> for [T] {
69 fn index(&self, index: usize) -> &Self::Output {
74 #[lang = "drop_in_place"]
75 #[allow(unconditional_recursion)]
76 pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
77 // Code here does not matter - this is replaced by the
78 // real drop glue by the compiler.
79 drop_in_place(to_drop);
85 pub fn panic(_msg: &str) -> ! {
87 libc::puts("Panicking\0" as *const str as *const u8);
92 #[lang = "panic_location"]
93 struct PanicLocation {
99 #[lang = "panic_bounds_check"]
102 fn panic_bounds_check(index: usize, len: usize) -> ! {
104 libc::printf("index out of bounds: the len is %d but the index is %d\n\0" as *const str as *const i8, len, index);
110 extern "rust-intrinsic" {
116 trait Add<RHS = Self> {
119 fn add(self, rhs: RHS) -> Self::Output;
125 fn add(self, rhs: Self) -> Self {
133 fn add(self, rhs: Self) -> Self {
141 fn add(self, rhs: Self) -> Self {
149 fn add(self, rhs: Self) -> Self {
157 fn add(self, rhs: Self) -> Self {
163 pub trait Sub<RHS = Self> {
166 fn sub(self, rhs: RHS) -> Self::Output;
172 fn sub(self, rhs: Self) -> Self {
180 fn sub(self, rhs: Self) -> Self {
188 fn sub(self, rhs: Self) -> Self {
196 fn sub(self, rhs: Self) -> Self {
204 fn sub(self, rhs: Self) -> Self {
210 pub trait PartialEq<Rhs: ?Sized = Self> {
211 fn eq(&self, other: &Rhs) -> bool;
212 fn ne(&self, other: &Rhs) -> bool;
215 impl PartialEq for u8 {
216 fn eq(&self, other: &u8) -> bool {
219 fn ne(&self, other: &u8) -> bool {
224 impl PartialEq for u16 {
225 fn eq(&self, other: &u16) -> bool {
228 fn ne(&self, other: &u16) -> bool {
233 impl PartialEq for u32 {
234 fn eq(&self, other: &u32) -> bool {
237 fn ne(&self, other: &u32) -> bool {
243 impl PartialEq for u64 {
244 fn eq(&self, other: &u64) -> bool {
247 fn ne(&self, other: &u64) -> bool {
252 impl PartialEq for usize {
253 fn eq(&self, other: &usize) -> bool {
256 fn ne(&self, other: &usize) -> bool {
261 impl PartialEq for i8 {
262 fn eq(&self, other: &i8) -> bool {
265 fn ne(&self, other: &i8) -> bool {
270 impl PartialEq for i32 {
271 fn eq(&self, other: &i32) -> bool {
274 fn ne(&self, other: &i32) -> bool {
279 impl PartialEq for isize {
280 fn eq(&self, other: &isize) -> bool {
283 fn ne(&self, other: &isize) -> bool {
288 impl PartialEq for char {
289 fn eq(&self, other: &char) -> bool {
292 fn ne(&self, other: &char) -> bool {
302 fn main(argc: isize, _argv: *const *const u8) -> isize {
305 libc::printf(b"true\n\0" as *const u8 as *const i8);
317 libc::printf(string as *const u8 as *const i8);