diff options
Diffstat (limited to 'compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs')
-rw-r--r-- | compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs b/compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs index 14fd9eeff..cff260777 100644 --- a/compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs +++ b/compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs @@ -1,7 +1,7 @@ // 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] @@ -85,6 +85,7 @@ fn start<T: Termination + 'static>( main: fn() -> T, argc: isize, argv: *const *const u8, + _sigpipe: u8, ) -> isize { if argc == 3 { unsafe { puts(*argv); } @@ -162,7 +163,7 @@ fn main() { 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>; @@ -222,12 +223,13 @@ fn main() { } } - 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), |