summaryrefslogtreecommitdiff
path: root/src/idl_gen_rust.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/idl_gen_rust.cpp')
-rw-r--r--src/idl_gen_rust.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/idl_gen_rust.cpp b/src/idl_gen_rust.cpp
index 9e7e51e6..455780cd 100644
--- a/src/idl_gen_rust.cpp
+++ b/src/idl_gen_rust.cpp
@@ -746,9 +746,9 @@ class RustGenerator : public BaseGenerator {
code_ += " type Inner = Self;";
code_ += " #[inline]";
code_ += " fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {";
- code_ +=
- " let b = flatbuffers::read_scalar_at::<{{BASE_TYPE}}>(buf,"
- " loc);";
+ code_ += " let b = unsafe {";
+ code_ += " flatbuffers::read_scalar_at::<{{BASE_TYPE}}>(buf, loc)";
+ code_ += " };";
code_ += " {{FROM_BASE}}";
code_ += " }";
code_ += "}";
@@ -758,8 +758,8 @@ class RustGenerator : public BaseGenerator {
code_ += " #[inline]";
code_ += " fn push(&self, dst: &mut [u8], _rest: &[u8]) {";
code_ +=
- " flatbuffers::emplace_scalar::<{{BASE_TYPE}}>"
- "(dst, {{INTO_BASE}});";
+ " unsafe { flatbuffers::emplace_scalar::<{{BASE_TYPE}}>"
+ "(dst, {{INTO_BASE}}); }";
code_ += " }";
code_ += "}";
code_ += "";