update host files after recent code gen changes

This commit is contained in:
Folkert 2020-11-02 16:29:51 +01:00
parent 497adb2ec4
commit eedf746ec7
5 changed files with 41 additions and 21 deletions

View file

@ -164,12 +164,12 @@ mod cli_run {
#[test] #[test]
#[serial(multi_dep_str)] #[serial(multi_dep_str)]
fn run_multi_dep_str() { fn run_multi_dep_str_unoptimized() {
if true { // if true {
todo!( // todo!(
"fix this test so it no longer deadlocks and hangs during monomorphization! The test never shows the error; to see the panic error, run this: cargo run run cli/tests/fixtures/multi-dep-str/Main.roc" // "fix this test so it no longer deadlocks and hangs during monomorphization! The test never shows the error; to see the panic error, run this: cargo run run cli/tests/fixtures/multi-dep-str/Main.roc"
); // );
} // }
check_output( check_output(
&fixture_file("multi-dep-str", "Main.roc"), &fixture_file("multi-dep-str", "Main.roc"),
@ -198,7 +198,7 @@ mod cli_run {
#[test] #[test]
#[serial(multi_dep_thunk)] #[serial(multi_dep_thunk)]
fn run_multi_dep_thunk() { fn run_multi_dep_thunk_unoptimized() {
check_output( check_output(
&fixture_file("multi-dep-thunk", "Main.roc"), &fixture_file("multi-dep-thunk", "Main.roc"),
&[], &[],

View file

@ -8,6 +8,6 @@ edition = "2018"
crate-type = ["staticlib"] crate-type = ["staticlib"]
[dependencies] [dependencies]
roc_std = { path = "../../../roc_std" } roc_std = { path = "../../../../../roc_std" }
[workspace] [workspace]

View file

@ -1,17 +1,27 @@
use roc_std::RocCallResult;
use roc_std::RocStr; use roc_std::RocStr;
use std::str; use std::str;
extern "C" { extern "C" {
#[link_name = "main_1"] #[link_name = "main_1_exposed"]
fn main() -> RocStr; fn say_hello(output: &mut RocCallResult<RocStr>) -> ();
} }
#[no_mangle] #[no_mangle]
pub fn rust_main() -> isize { pub fn rust_main() -> isize {
println!( let answer = unsafe {
"Roc says: {}", use std::mem::MaybeUninit;
str::from_utf8(unsafe { main().as_slice() }).unwrap() let mut output: MaybeUninit<RocCallResult<RocStr>> = MaybeUninit::uninit();
);
say_hello(&mut *output.as_mut_ptr());
match output.assume_init().into() {
Ok(value) => value,
Err(msg) => panic!("roc failed with message {}", msg),
}
};
println!("Roc says: {}", str::from_utf8(answer.as_slice()).unwrap());
// Exit code // Exit code
0 0

View file

@ -8,6 +8,6 @@ edition = "2018"
crate-type = ["staticlib"] crate-type = ["staticlib"]
[dependencies] [dependencies]
roc_std = { path = "../../../roc_std" } roc_std = { path = "../../../../../roc_std" }
[workspace] [workspace]

View file

@ -1,17 +1,27 @@
use roc_std::RocCallResult;
use roc_std::RocStr; use roc_std::RocStr;
use std::str; use std::str;
extern "C" { extern "C" {
#[link_name = "main_1"] #[link_name = "main_1_exposed"]
fn main() -> RocStr; fn say_hello(output: &mut RocCallResult<RocStr>) -> ();
} }
#[no_mangle] #[no_mangle]
pub fn rust_main() -> isize { pub fn rust_main() -> isize {
println!( let answer = unsafe {
"Roc says: {}", use std::mem::MaybeUninit;
str::from_utf8(unsafe { main().as_slice() }).unwrap() let mut output: MaybeUninit<RocCallResult<RocStr>> = MaybeUninit::uninit();
);
say_hello(&mut *output.as_mut_ptr());
match output.assume_init().into() {
Ok(value) => value,
Err(msg) => panic!("roc failed with message {}", msg),
}
};
println!("Roc says: {}", str::from_utf8(answer.as_slice()).unwrap());
// Exit code // Exit code
0 0