Skip to content

Commit 060520a

Browse files
committed
fix rust codegen build errors
Signed-off-by: Joel Dice <[email protected]>
1 parent 5fd6ec4 commit 060520a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

crates/rust/src/interface.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ macro_rules! {macro_name} {{
674674
lift_read = self.lift_from_memory("src", &payload_type, &module);
675675
start_read_sig = "fn future_read(_: u32, _: *mut u8) -> u32".to_owned();
676676
start_read = "unsafe extern \"C\" fn start_read(future: u32, dst: *mut u8) \
677-
-> u32 { future_read(future, dst) }"
677+
-> u32 { unsafe { future_read(future, dst) } }"
678678
.to_owned();
679679
if sig.indirect_params {
680680
lift_write = self.lift_from_memory(
@@ -686,7 +686,7 @@ macro_rules! {macro_name} {{
686686
lower = format!(
687687
r#"
688688
let (ptr, cleanup) = {runtime}::Cleanup::new(
689-
::std::alloc::Layout::from_size_align_unchecked({size}, {align})
689+
unsafe {{ ::std::alloc::Layout::from_size_align_unchecked({size}, {align}) }}
690690
);
691691
{body}
692692
dst[0] = {async_support}::CoreVal {{ as_i32: ptr as isize as i32 }};
@@ -696,7 +696,7 @@ macro_rules! {macro_name} {{
696696
start_write_sig = "fn future_write(_: u32, _: *const u8) -> u32".to_owned();
697697
start_write = format!(
698698
"unsafe extern \"C\" fn start_write(future: u32, src: &{async_support}::LoweredWrite) \
699-
-> u32 {{ future_write(future, src[0].as_i32 as isize as *const u8) }}"
699+
-> u32 {{ unsafe {{ future_write(future, src[0].as_i32 as isize as *const u8) }} }}"
700700
);
701701
} else {
702702
lift_write = self.lift_flat(
@@ -738,7 +738,7 @@ macro_rules! {macro_name} {{
738738
.join(", ");
739739
start_write = format!(
740740
"unsafe extern \"C\" fn start_write(future: u32, src: &{async_support}::LoweredWrite) \
741-
-> u32 {{ future_write(future, {args}) }}"
741+
-> u32 {{ unsafe {{ future_write(future, {args}) }} }}"
742742
);
743743
}
744744
} else {
@@ -749,11 +749,12 @@ macro_rules! {macro_name} {{
749749
start_read_sig = format!("fn future_read(_: u32) -> u32");
750750
start_write_sig = format!("fn future_write(_: u32) -> u32");
751751
start_read = format!(
752-
"unsafe extern \"C\" fn start_read(future: u32, _: *mut u8) -> u32 {{ future_read(future) }}"
752+
"unsafe extern \"C\" fn start_read(future: u32, _: *mut u8) \
753+
-> u32 {{ unsafe {{ future_read(future) }} }}"
753754
);
754755
start_write = format!(
755756
"unsafe extern \"C\" fn start_write(future: u32, _: &{async_support}::LoweredWrite) \
756-
-> u32 {{ future_write(future) }}"
757+
-> u32 {{ unsafe {{ future_write(future) }} }}"
757758
);
758759
}
759760

0 commit comments

Comments
 (0)