// Adapted from https://github.com/sunfishcode/mir2cranelift/blob/master/rust-examples/nocore-hello-world.rs
#![feature(
- no_core, unboxed_closures, start, lang_items, box_syntax, never_type, linkage,
+ no_core, unboxed_closures, start, lang_items, never_type, linkage,
extern_types, thread_local
)]
#![no_core]
main: fn() -> T,
argc: isize,
argv: *const *const u8,
+ _sigpipe: u8,
) -> isize {
if argc == 3 {
unsafe { puts(*argv); }
let ptr: *const u8 = hello as *const [u8] as *const u8;
puts(ptr);
- let world: Box<&str> = box "World!\0";
+ let world: Box<&str> = Box::new("World!\0");
puts(*world as *const str as *const u8);
world as Box<dyn SomeTrait>;
}
}
- let _ = box NoisyDrop {
+ let _ = Box::new(NoisyDrop {
text: "Boxed outer got dropped!\0",
inner: NoisyDropInner,
- } as Box<dyn SomeTrait>;
+ }) as Box<dyn SomeTrait>;
const FUNC_REF: Option<fn()> = Some(main);
+ #[allow(unreachable_code)]
match FUNC_REF {
Some(_) => {},
None => assert!(false),