mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-19 03:23:05 +00:00
Support Rust edition 2024 (#8638)
* Developers intro how to contribute * Fix Rust code generation for Rust edition 2024 The errors look like: ``` warning[E0133]: call to unsafe function `fbs::flatbuffers::emplace_scalar` is unsafe and requires unsafe block warning[E0133]: call to unsafe function `fbs::flatbuffers::follow_cast_ref` is unsafe and requires unsafe block warning[E0133]: call to unsafe function `fbs::flatbuffers::Follow::follow` is unsafe and requires unsafe block warning[E0133]: call to unsafe function `fbs::flatbuffers::read_scalar_at` is unsafe and requires unsafe block warning[E0133]: call to unsafe function `fbs::flatbuffers::root_unchecked` is unsafe and requires unsafe block warning[E0133]: call to unsafe function `fbs::flatbuffers::size_prefixed_root_unchecked` is unsafe and requires unsafe block warning[E0133]: call to unsafe function `fbs::flatbuffers::Table::<'a>::new` is unsafe and requires unsafe block warning[E0133]: call to unsafe function `std::slice::from_raw_parts` is unsafe and requires unsafe block ``` * Update goldens Ran `goldens/generate_goldens.py` * Regenerate code files Ran `scripts/generate_code.py`
This commit is contained in:
@@ -20,7 +20,7 @@ impl<'a> flatbuffers::Follow<'a> for ArrayTable<'a> {
|
||||
type Inner = ArrayTable<'a>;
|
||||
#[inline]
|
||||
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: flatbuffers::Table::new(buf, loc) }
|
||||
Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,14 +193,14 @@ pub fn size_prefixed_root_as_array_table_with_opts<'b, 'o>(
|
||||
/// # Safety
|
||||
/// Callers must trust the given bytes do indeed contain a valid `ArrayTable`.
|
||||
pub unsafe fn root_as_array_table_unchecked(buf: &[u8]) -> ArrayTable {
|
||||
flatbuffers::root_unchecked::<ArrayTable>(buf)
|
||||
unsafe { flatbuffers::root_unchecked::<ArrayTable>(buf) }
|
||||
}
|
||||
#[inline]
|
||||
/// Assumes, without verification, that a buffer of bytes contains a size prefixed ArrayTable and returns it.
|
||||
/// # Safety
|
||||
/// Callers must trust the given bytes do indeed contain a valid size prefixed `ArrayTable`.
|
||||
pub unsafe fn size_prefixed_root_as_array_table_unchecked(buf: &[u8]) -> ArrayTable {
|
||||
flatbuffers::size_prefixed_root_unchecked::<ArrayTable>(buf)
|
||||
unsafe { flatbuffers::size_prefixed_root_unchecked::<ArrayTable>(buf) }
|
||||
}
|
||||
pub const ARRAY_TABLE_IDENTIFIER: &str = "ARRT";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user