Skip to content

fix: complying with rust edition 2024 (unsafe_op_in_unsafe_fn) #8606

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions goldens/rust/basic_generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl<'a> flatbuffers::Follow<'a> for Galaxy<'a> {
type Inner = Galaxy<'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) } }
}
}

Expand Down Expand Up @@ -134,7 +134,7 @@ impl<'a> flatbuffers::Follow<'a> for Universe<'a> {
type Inner = Universe<'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) } }
}
}

Expand Down
20 changes: 10 additions & 10 deletions rust/reflection/src/reflection_generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ impl<'a> flatbuffers::Follow<'a> for Type<'a> {
type Inner = Type<'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) } }
}
}

Expand Down Expand Up @@ -427,7 +427,7 @@ impl<'a> flatbuffers::Follow<'a> for KeyValue<'a> {
type Inner = KeyValue<'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) } }
}
}

Expand Down Expand Up @@ -552,7 +552,7 @@ impl<'a> flatbuffers::Follow<'a> for EnumVal<'a> {
type Inner = EnumVal<'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) } }
}
}

Expand Down Expand Up @@ -728,7 +728,7 @@ impl<'a> flatbuffers::Follow<'a> for Enum<'a> {
type Inner = Enum<'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) } }
}
}

Expand Down Expand Up @@ -941,7 +941,7 @@ impl<'a> flatbuffers::Follow<'a> for Field<'a> {
type Inner = Field<'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) } }
}
}

Expand Down Expand Up @@ -1273,7 +1273,7 @@ impl<'a> flatbuffers::Follow<'a> for Object<'a> {
type Inner = Object<'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) } }
}
}

Expand Down Expand Up @@ -1502,7 +1502,7 @@ impl<'a> flatbuffers::Follow<'a> for RPCCall<'a> {
type Inner = RPCCall<'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) } }
}
}

Expand Down Expand Up @@ -1680,7 +1680,7 @@ impl<'a> flatbuffers::Follow<'a> for Service<'a> {
type Inner = Service<'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) } }
}
}

Expand Down Expand Up @@ -1860,7 +1860,7 @@ impl<'a> flatbuffers::Follow<'a> for SchemaFile<'a> {
type Inner = SchemaFile<'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) } }
}
}

Expand Down Expand Up @@ -1987,7 +1987,7 @@ impl<'a> flatbuffers::Follow<'a> for Schema<'a> {
type Inner = Schema<'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) } }
}
}

Expand Down
2 changes: 1 addition & 1 deletion samples/rust_generated/my_game/sample/monster_generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl<'a> flatbuffers::Follow<'a> for Monster<'a> {
type Inner = Monster<'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) } }
}
}

Expand Down
2 changes: 1 addition & 1 deletion samples/rust_generated/my_game/sample/weapon_generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl<'a> flatbuffers::Follow<'a> for Weapon<'a> {
type Inner = Weapon<'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) } }
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/idl_gen_rust.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1658,7 +1658,7 @@ class RustGenerator : public BaseGenerator {
code_ += " type Inner = {{STRUCT_TY}}<'a>;";
code_ += " #[inline]";
code_ += " unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {";
code_ += " Self { _tab: flatbuffers::Table::new(buf, loc) }";
code_ += " Self { _tab: unsafe { flatbuffers::Table::new(buf, loc) } }";
code_ += " }";
code_ += "}";
code_ += "";
Expand Down
2 changes: 1 addition & 1 deletion tests/arrays_test/my_game/example/array_table_generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) } }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl<'a> flatbuffers::Follow<'a> for TableB<'a> {
type Inner = TableB<'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) } }
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/include_test1/table_a_generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl<'a> flatbuffers::Follow<'a> for TableA<'a> {
type Inner = TableA<'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) } }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl<'a> flatbuffers::Follow<'a> for TableB<'a> {
type Inner = TableB<'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) } }
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/include_test2/table_a_generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl<'a> flatbuffers::Follow<'a> for TableA<'a> {
type Inner = TableA<'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) } }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl<'a> flatbuffers::Follow<'a> for KeywordsInTable<'a> {
type Inner = KeywordsInTable<'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) } }
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/keyword_test/keyword_test/table_2_generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl<'a> flatbuffers::Follow<'a> for Table2<'a> {
type Inner = Table2<'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) } }
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/monster_test/my_game/example/monster_generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl<'a> flatbuffers::Follow<'a> for Monster<'a> {
type Inner = Monster<'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) } }
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/monster_test/my_game/example/referrable_generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl<'a> flatbuffers::Follow<'a> for Referrable<'a> {
type Inner = Referrable<'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) } }
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/monster_test/my_game/example/stat_generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl<'a> flatbuffers::Follow<'a> for Stat<'a> {
type Inner = Stat<'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) } }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl<'a> flatbuffers::Follow<'a> for TestSimpleTableWithEnum<'a> {
type Inner = TestSimpleTableWithEnum<'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) } }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl<'a> flatbuffers::Follow<'a> for TypeAliases<'a> {
type Inner = TypeAliases<'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) } }
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/monster_test/my_game/example_2/monster_generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl<'a> flatbuffers::Follow<'a> for Monster<'a> {
type Inner = Monster<'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) } }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl<'a> flatbuffers::Follow<'a> for InParentNamespace<'a> {
type Inner = InParentNamespace<'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) } }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl<'a> flatbuffers::Follow<'a> for TableB<'a> {
type Inner = TableB<'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) } }
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/monster_test/table_a_generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl<'a> flatbuffers::Follow<'a> for TableA<'a> {
type Inner = TableA<'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) } }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl<'a> flatbuffers::Follow<'a> for Monster<'a> {
type Inner = Monster<'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) } }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl<'a> flatbuffers::Follow<'a> for Referrable<'a> {
type Inner = Referrable<'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) } }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl<'a> flatbuffers::Follow<'a> for Stat<'a> {
type Inner = Stat<'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) } }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl<'a> flatbuffers::Follow<'a> for TestSimpleTableWithEnum<'a> {
type Inner = TestSimpleTableWithEnum<'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) } }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl<'a> flatbuffers::Follow<'a> for TypeAliases<'a> {
type Inner = TypeAliases<'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) } }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl<'a> flatbuffers::Follow<'a> for Monster<'a> {
type Inner = Monster<'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) } }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl<'a> flatbuffers::Follow<'a> for InParentNamespace<'a> {
type Inner = InParentNamespace<'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) } }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl<'a> flatbuffers::Follow<'a> for TableB<'a> {
type Inner = TableB<'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) } }
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/monster_test_serialize/table_a_generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl<'a> flatbuffers::Follow<'a> for TableA<'a> {
type Inner = TableA<'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) } }
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/more_defaults/more_defaults_generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl<'a> flatbuffers::Follow<'a> for MoreDefaults<'a> {
type Inner = MoreDefaults<'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) } }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl<'a> flatbuffers::Follow<'a> for TableInNestedNS<'a> {
type Inner = TableInNestedNS<'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) } }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl<'a> flatbuffers::Follow<'a> for SecondTableInA<'a> {
type Inner = SecondTableInA<'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) } }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl<'a> flatbuffers::Follow<'a> for TableInFirstNS<'a> {
type Inner = TableInFirstNS<'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) } }
}
}

Expand Down
Loading