]> git.proxmox.com Git - rustc.git/blame - src/test/run-pass/smallest-hello-world.rs
Imported Upstream version 1.3.0+dfsg1
[rustc.git] / src / test / run-pass / smallest-hello-world.rs
CommitLineData
1a4d82fc
JJ
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
1a4d82fc
JJ
11// Smallest "hello world" with a libc runtime
12
c34b1796
AL
13// pretty-expanded FIXME #23616
14
15#![feature(intrinsics, lang_items, start, no_std, libc)]
1a4d82fc 16#![no_std]
1a4d82fc
JJ
17
18extern crate libc;
19
20extern { fn puts(s: *const u8); }
21extern "rust-intrinsic" { fn transmute<T, U>(t: T) -> U; }
22
23#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
24#[lang = "eh_personality"] extern fn eh_personality() {}
c1a9b12d 25#[lang = "eh_unwind_resume"] extern fn eh_unwind_resume() {}
1a4d82fc
JJ
26#[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} }
27
28#[start]
29#[no_stack_check]
c34b1796 30fn main(_: isize, _: *const *const u8) -> isize {
1a4d82fc 31 unsafe {
c34b1796 32 let (ptr, _): (*const u8, usize) = transmute("Hello!\0");
1a4d82fc
JJ
33 puts(ptr);
34 }
35 return 0;
36}
37
85aaf69f
SL
38#[cfg(target_os = "android")]
39#[link(name="gcc")]
40extern { }