Переглянути джерело

clippy: fix and deny unsafe_attr_outside_unsafe warning for edition 2024 migration (#9011)

* chore: add unsafe annotation for no_mangle attribute

* chore: deny unsafe_attr_outside_unsafe
Kamil Skalski 1 тиждень тому
батько
коміт
fff036c486
3 змінених файлів з 5 додано та 3 видалено
  1. 1 0
      Cargo.toml
  2. 1 0
      dev-bins/Cargo.toml
  3. 3 3
      svm-test-harness/src/fuzz.rs

+ 1 - 0
Cargo.toml

@@ -177,6 +177,7 @@ rust_2024_guarded_string_incompatible_syntax = "deny"
 rust_2024_incompatible_pat = "deny"
 rust_2024_prelude_collisions = "deny"
 static_mut_refs = "deny"
+unsafe_attr_outside_unsafe = "deny"
 
 [workspace.lints.rust.unexpected_cfgs]
 level = "warn"

+ 1 - 0
dev-bins/Cargo.toml

@@ -33,6 +33,7 @@ rust_2024_guarded_string_incompatible_syntax = "deny"
 rust_2024_incompatible_pat = "deny"
 rust_2024_prelude_collisions = "deny"
 static_mut_refs = "deny"
+unsafe_attr_outside_unsafe = "deny"
 
 [workspace.lints.rust.unexpected_cfgs]
 level = "warn"

+ 3 - 3
svm-test-harness/src/fuzz.rs

@@ -16,7 +16,7 @@ use {
     std::{env, ffi::c_int, sync::Arc},
 };
 
-#[no_mangle]
+#[unsafe(no_mangle)]
 pub unsafe extern "C" fn sol_compat_init(_log_level: i32) {
     unsafe {
         env::set_var("SOLANA_RAYON_THREADS", "1");
@@ -28,7 +28,7 @@ pub unsafe extern "C" fn sol_compat_init(_log_level: i32) {
     }
 }
 
-#[no_mangle]
+#[unsafe(no_mangle)]
 pub unsafe extern "C" fn sol_compat_fini() {}
 
 pub fn execute_instr_proto(input: ProtoInstrContext) -> Option<ProtoInstrEffects> {
@@ -90,7 +90,7 @@ pub fn execute_instr_proto(input: ProtoInstrContext) -> Option<ProtoInstrEffects
     instr_effects.map(Into::into)
 }
 
-#[no_mangle]
+#[unsafe(no_mangle)]
 pub unsafe extern "C" fn sol_compat_instr_execute_v1(
     out_ptr: *mut u8,
     out_psz: *mut u64,