1
Fork 0

Use malloc in mini_core::allocate

This commit is contained in:
bjorn3 2019-01-26 15:10:21 +01:00
parent 4fbff29a4a
commit 4bca86c236
2 changed files with 56 additions and 16 deletions

View file

@ -7,11 +7,7 @@
extern crate mini_core;
use mini_core::*;
#[link(name = "c")]
extern "C" {
fn puts(s: *const u8);
}
use mini_core::libc::*;
unsafe extern "C" fn my_puts(s: *const u8) {
puts(s);
@ -132,13 +128,9 @@ fn main() {
let ptr: *const u8 = hello as *const [u8] as *const u8;
puts(ptr);
// TODO remove when jit supports linking rlibs
#[cfg(not(jit))]
{
let world: Box<&str> = box "World!\0";
puts(*world as *const str as *const u8);
world as Box<SomeTrait>;
}
let world: Box<&str> = box "World!\0";
puts(*world as *const str as *const u8);
world as Box<SomeTrait>;
assert_eq!(intrinsics::size_of_val(hello) as u8, 6);