Use malloc in mini_core::allocate
This commit is contained in:
parent
4fbff29a4a
commit
4bca86c236
2 changed files with 56 additions and 16 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue