Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/hyperlight_component_util/src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ fn emit_export_extern_decl<'a, 'b, 'c>(
(#(#marshal,)*)
);
let ::std::result::Result::Ok(#ret) = #ret else { panic!("bad return from guest {:?}", #ret) };
#[allow(clippy::unused_unit)]
#unmarshal
}
}
Expand Down
7 changes: 7 additions & 0 deletions src/hyperlight_host/tests/wit_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ impl test::wit::Roundtrip for Host {
) -> test::wit::roundtrip::Testenum {
x
}

fn roundtrip_no_result(&mut self, _x: u32) {}
}

struct TestResource {
Expand Down Expand Up @@ -330,6 +332,11 @@ mod wit_test {
make_test! { roundtrip_variant, in arb_testvariant() }
make_test! { roundtrip_enum, in arb_testenum() }

#[test]
fn test_simple_func() {
sb().roundtrip().roundtrip_no_result(42);
}

#[test]
fn test_host_resource() {
{
Expand Down
1 change: 1 addition & 0 deletions src/tests/rust_guests/witguest/guest.wit
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ interface roundtrip {
roundtrip-tuple: func(x: tuple<string, u8>) -> tuple<string, u8>;
roundtrip-option: func(x: option<string>) -> option<string>;
roundtrip-result: func(x: result<char, string>) -> result<char, string>;
roundtrip-no-result: func(x: u32);

record testrecord {
contents: string,
Expand Down
3 changes: 3 additions & 0 deletions src/tests/rust_guests/witguest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ impl test::wit::Roundtrip for Guest {
) -> test::wit::roundtrip::Testenum {
(Host {}).roundtrip_enum(x)
}
fn roundtrip_no_result(&mut self, x: u32) {
(Host {}).roundtrip_no_result(x)
}
}

impl test::wit::TestHostResource for Guest {
Expand Down
Loading