mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-29 11:02:02 +00:00
fix(idl_gen_rust): Fix lifetime warning added in Rust 1.89 (#8709)
Rust 1.89 added a new lifetime-related warning: <https://blog.rust-lang.org/2025/08/07/Rust-1.89.0/#mismatched-lifetime-syntaxes-lint> The Rust code generator currently emits code which trips this warning. This very small PR fixes the issue for the relevant generated functions and for the Rust flexbuffers code. Fixes #8705
This commit is contained in:
@@ -244,7 +244,7 @@ impl core::fmt::Debug for Universe<'_> {
|
||||
/// catch every error, or be maximally performant. For the
|
||||
/// previous, unchecked, behavior use
|
||||
/// `root_as_universe_unchecked`.
|
||||
pub fn root_as_universe(buf: &[u8]) -> Result<Universe, flatbuffers::InvalidFlatbuffer> {
|
||||
pub fn root_as_universe(buf: &[u8]) -> Result<Universe<'_>, flatbuffers::InvalidFlatbuffer> {
|
||||
flatbuffers::root::<Universe>(buf)
|
||||
}
|
||||
#[inline]
|
||||
@@ -254,7 +254,7 @@ pub fn root_as_universe(buf: &[u8]) -> Result<Universe, flatbuffers::InvalidFlat
|
||||
/// catch every error, or be maximally performant. For the
|
||||
/// previous, unchecked, behavior use
|
||||
/// `size_prefixed_root_as_universe_unchecked`.
|
||||
pub fn size_prefixed_root_as_universe(buf: &[u8]) -> Result<Universe, flatbuffers::InvalidFlatbuffer> {
|
||||
pub fn size_prefixed_root_as_universe(buf: &[u8]) -> Result<Universe<'_>, flatbuffers::InvalidFlatbuffer> {
|
||||
flatbuffers::size_prefixed_root::<Universe>(buf)
|
||||
}
|
||||
#[inline]
|
||||
@@ -287,14 +287,14 @@ pub fn size_prefixed_root_as_universe_with_opts<'b, 'o>(
|
||||
/// Assumes, without verification, that a buffer of bytes contains a Universe and returns it.
|
||||
/// # Safety
|
||||
/// Callers must trust the given bytes do indeed contain a valid `Universe`.
|
||||
pub unsafe fn root_as_universe_unchecked(buf: &[u8]) -> Universe {
|
||||
pub unsafe fn root_as_universe_unchecked(buf: &[u8]) -> Universe<'_> {
|
||||
unsafe { flatbuffers::root_unchecked::<Universe>(buf) }
|
||||
}
|
||||
#[inline]
|
||||
/// Assumes, without verification, that a buffer of bytes contains a size prefixed Universe and returns it.
|
||||
/// # Safety
|
||||
/// Callers must trust the given bytes do indeed contain a valid size prefixed `Universe`.
|
||||
pub unsafe fn size_prefixed_root_as_universe_unchecked(buf: &[u8]) -> Universe {
|
||||
pub unsafe fn size_prefixed_root_as_universe_unchecked(buf: &[u8]) -> Universe<'_> {
|
||||
unsafe { flatbuffers::size_prefixed_root_unchecked::<Universe>(buf) }
|
||||
}
|
||||
#[inline]
|
||||
|
||||
Reference in New Issue
Block a user