mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 00:03:43 +00:00
Improve mini_core_hello_world.rs
This commit is contained in:
parent
af69258971
commit
9a8c25ae75
@ -140,6 +140,11 @@ pub fn panic(_expr_file_line_col: &(&'static str, &'static str, u32, u32)) -> !
|
||||
loop {}
|
||||
}
|
||||
|
||||
#[lang = "eh_personality"]
|
||||
fn eh_personality() -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
#[lang = "drop_in_place"]
|
||||
#[allow(unconditional_recursion)]
|
||||
pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
|
||||
|
@ -1,7 +1,8 @@
|
||||
// Adapted from https://github.com/sunfishcode/mir2cranelift/blob/master/rust-examples/nocore-hello-world.rs
|
||||
|
||||
#![feature(no_core, unboxed_closures, start)]
|
||||
#![feature(no_core, unboxed_closures, start, lang_items)]
|
||||
#![no_core]
|
||||
#![no_main]
|
||||
#![allow(dead_code)]
|
||||
|
||||
extern crate mini_core;
|
||||
@ -15,11 +16,11 @@ extern "C" {
|
||||
fn puts(s: *const u8);
|
||||
}
|
||||
|
||||
#[start]
|
||||
fn main(i: isize, _: *const *const u8) -> isize {
|
||||
#[lang = "start"]
|
||||
fn start(_main: *const u8, i: isize, _: *const *const u8) -> isize {
|
||||
unsafe {
|
||||
let (ptr, _): (*const u8, usize) = intrinsics::transmute("Hello!\0");
|
||||
puts(ptr);
|
||||
}
|
||||
0
|
||||
42
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user