mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-04 20:48:59 +00:00
Rust soundness fixes (#7518)
* Rust soundness fixes * Second pass * Make init_from_table unsafe * Remove SafeSliceAccess * Clippy * Remove create_vector_of_strings * More clippy * Remove deprecated root type accessors * More soundness fixes * Fix EndianScalar for bool * Add TriviallyTransmutable * Add debug assertions * Review comments * Review feedback
This commit is contained in:
committed by
GitHub
parent
dadbff5714
commit
374f8fb5fb
@@ -122,10 +122,7 @@ fn main() {
|
||||
// Get an element from the `inventory` FlatBuffer's `vector`.
|
||||
assert!(monster.inventory().is_some());
|
||||
let inv = monster.inventory().unwrap();
|
||||
|
||||
// Note that this vector is returned as a slice, because direct access for
|
||||
// this type, a u8 vector, is safe on all platforms:
|
||||
let third_item = inv[2];
|
||||
let third_item = inv.get(2);
|
||||
assert_eq!(third_item, 2);
|
||||
|
||||
// Get and test the `weapons` FlatBuffers's `vector`.
|
||||
|
||||
Reference in New Issue
Block a user