script_bindings Start wrapping unsafe code in unsafe {} (#38545)

This is useful to better isolate `unsafe` code. Once all unsafe calls
are wrapped we can enable the Rust warning.  This also explicitly
disables the warning for generated code, which is a much more difficult
task. After this change there are 211 warnings left in
`script_bindings`.

Testing: This should not change behavior and is thus covered by existing
tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2025-08-08 14:21:31 +02:00 committed by GitHub
parent c9541f2906
commit 5c307a38df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 91 additions and 70 deletions

View file

@ -16,5 +16,5 @@ pub(crate) unsafe fn malloc_size_of_including_raw_self<T: MallocSizeOf>(
ops: &mut MallocSizeOfOps,
obj: *const c_void,
) -> usize {
ops.malloc_size_of(obj) + (*(obj as *const T)).size_of(ops)
unsafe { ops.malloc_size_of(obj) + (*(obj as *const T)).size_of(ops) }
}