]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/smallest-hello-world.rs
Rollup merge of #27612 - vincentbernat:fix/doc/iter-nth, r=steveklabnik
[rust.git] / src / test / run-pass / smallest-hello-world.rs
1 // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // Smallest "hello world" with a libc runtime
12
13 // pretty-expanded FIXME #23616
14
15 #![feature(intrinsics, lang_items, start, no_core, libc)]
16 #![no_core]
17
18 extern crate libc;
19
20 extern { fn puts(s: *const u8); }
21 extern "rust-intrinsic" { fn transmute<T, U>(t: T) -> U; }
22
23 #[lang = "eh_personality"] extern fn eh_personality() {}
24 #[lang = "eh_unwind_resume"] extern fn eh_unwind_resume() {}
25 #[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} }
26
27 #[start]
28 fn main(_: isize, _: *const *const u8) -> isize {
29     unsafe {
30         let (ptr, _): (*const u8, usize) = transmute("Hello!\0");
31         puts(ptr);
32     }
33     return 0;
34 }
35
36 #[cfg(target_os = "android")]
37 #[link(name="gcc")]
38 extern { }