forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.rs
34 lines (27 loc) · 733 Bytes
/
main.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#![feature(lang_items)]
#![feature(start)]
#![no_std]
use core::fmt;
use core::fmt::Write;
#[cfg_attr(not(target_env = "msvc"), link(name = "c"))]
#[cfg_attr(all(target_env = "msvc", target_feature = "crt-static"), link(name = "libcmt"))]
#[cfg_attr(all(target_env = "msvc", not(target_feature = "crt-static")), link(name = "msvcrt"))]
extern "C" {}
struct Dummy;
impl fmt::Write for Dummy {
#[inline(never)]
fn write_str(&mut self, _: &str) -> fmt::Result {
Ok(())
}
}
#[start]
fn main(_: isize, _: *const *const u8) -> isize {
let _ = writeln!(Dummy, "Hello World");
0
}
#[lang = "eh_personality"]
fn eh_personality() {}
#[panic_handler]
fn panic(_: &core::panic::PanicInfo) -> ! {
loop {}
}