diff options
Diffstat (limited to 'components/allocator')
-rw-r--r-- | components/allocator/Cargo.toml | 3 | ||||
-rw-r--r-- | components/allocator/lib.rs | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/components/allocator/Cargo.toml b/components/allocator/Cargo.toml index ce66c31833b..aadd23e4b81 100644 --- a/components/allocator/Cargo.toml +++ b/components/allocator/Cargo.toml @@ -23,3 +23,6 @@ windows-sys = { workspace = true, features = ["Win32_System_Memory"] } [target.'cfg(target_env = "ohos")'.dependencies] libc = { workspace = true } + +[lints.rust] +unsafe_op_in_unsafe_fn = { level = "allow" } diff --git a/components/allocator/lib.rs b/components/allocator/lib.rs index 13f1d876eae..ed9ed7fc5fe 100644 --- a/components/allocator/lib.rs +++ b/components/allocator/lib.rs @@ -21,7 +21,7 @@ mod platform { /// /// Passing a non-heap allocated pointer to this function results in undefined behavior. pub unsafe extern "C" fn usable_size(ptr: *const c_void) -> usize { - tikv_jemallocator::usable_size(ptr) + unsafe { tikv_jemallocator::usable_size(ptr) } } /// Memory allocation APIs compatible with libc |