Skip to content
Closed
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
2 changes: 2 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ build --@rules_rust//rust/settings:clippy.toml=//tools/workspace:clippy.toml
# Strict tier lints rules_dx enforces.
common --@rules_dx//config:clippy_flag=-Dclippy::unwrap_used
common --@rules_dx//config:clippy_flag=-Dclippy::expect_used
common --@rules_dx//config:clippy_flag=-Dclippy::panic
common --@rules_dx//config:clippy_flag=-Dclippy::unreachable
common --@rules_dx//config:clippy_flag=-Dclippy::exit
common --@rules_dx//config:clippy_flag=-Dclippy::todo
Expand All @@ -47,6 +48,7 @@ common --@rules_dx//config:clippy_flag=-Dclippy::unwrap_in_result
common --@rules_dx//config:clippy_flag=-Dclippy::panic_in_result_fn
common --@rules_dx//config:clippy_flag=-Dclippy::allow_attributes
common --@rules_dx//config:clippy_flag=-Dclippy::allow_attributes_without_reason
common --@rules_dx//config:clippy_flag=-Dunsafe_code
common --@rules_dx//config:clippy_flag=-Dunsafe_op_in_unsafe_fn
common --@rules_dx//config:clippy_flag=-Dunused_must_use
build:linux --@rules_rust//rust/settings:pipelined_compilation=true
Expand Down
3 changes: 3 additions & 0 deletions apple/tests/fixtures/macos_bundle/ledger.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#![expect(unsafe_code, reason = "exports an unmangled C symbol for the native linker fixture")]

use std::ffi::{c_char, CStr};

#[unsafe(no_mangle)]
pub extern "C" fn ledger_total(text: *const c_char) -> i64 {
if text.is_null() {
return -1;
}
// SAFETY: the caller passes a non-null NUL-terminated string.
let Ok(text) = unsafe { CStr::from_ptr(text) }.to_str() else {
return -1;
};
Expand Down
3 changes: 3 additions & 0 deletions apple/tests/fixtures/shared_core/core.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![expect(unsafe_code, reason = "exports an unmangled C symbol for the native linker fixture")]

use std::ffi::{c_char, CStr};

use shared_tasks::{reply, Board};
Expand All @@ -7,6 +9,7 @@ pub extern "C" fn shared_core_open(board: *const c_char) -> i32 {
if board.is_null() {
return -1;
}
// SAFETY: the caller passes a non-null NUL-terminated string.
let Ok(text) = unsafe { CStr::from_ptr(board) }.to_str() else {
return -1;
};
Expand Down
3 changes: 3 additions & 0 deletions apple/tests/fixtures/swift_app/ledger.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#![expect(unsafe_code, reason = "exports an unmangled C symbol for the native linker fixture")]

use std::ffi::{c_char, CStr};

#[unsafe(no_mangle)]
pub extern "C" fn ledger_total(text: *const c_char) -> i64 {
if text.is_null() {
return -1;
}
// SAFETY: the caller passes a non-null NUL-terminated string.
let Ok(text) = unsafe { CStr::from_ptr(text) }.to_str() else {
return -1;
};
Expand Down
3 changes: 3 additions & 0 deletions apple/tests/fixtures/xcframework_share/share.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#![expect(unsafe_code, reason = "exports an unmangled C symbol for the native linker fixture")]

use std::ffi::{c_char, CStr};

#[unsafe(no_mangle)]
pub extern "C" fn share_total(text: *const c_char) -> i64 {
if text.is_null() {
return -1;
}
// SAFETY: the caller passes a non-null NUL-terminated string.
let Ok(text) = unsafe { CStr::from_ptr(text) }.to_str() else {
return -1;
};
Expand Down
2 changes: 2 additions & 0 deletions deploy/tests/fixtures/consumer_archive/app.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![expect(unsafe_code, reason = "the fixture exists to call across the C FFI boundary")]

use std::path::PathBuf;

unsafe extern "C" {
Expand Down
2 changes: 2 additions & 0 deletions rust/tests/fixtures/consumer_abi/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![expect(unsafe_code, reason = "the fixture exists to call across the C FFI boundary")]

use std::ffi::{c_char, CStr};

pub const API_VERSION: i32 = 1;
Expand Down
2 changes: 2 additions & 0 deletions rust/tests/fixtures/consumer_native/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![expect(unsafe_code, reason = "the fixture exists to call across the C FFI boundary")]

include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
include!(concat!(env!("OUT_DIR"), "/build_probe.rs"));

Expand Down
2 changes: 2 additions & 0 deletions rust/tests/fixtures/hello/src/cdylib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#![expect(unsafe_code, reason = "exports an unmangled C symbol for the native linker fixture")]

#[unsafe(no_mangle)]
pub extern "C" fn hello_cdylib() {}
2 changes: 2 additions & 0 deletions rust/tests/fixtures/hello/src/staticlib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#![expect(unsafe_code, reason = "exports an unmangled C symbol for the native linker fixture")]

#[unsafe(no_mangle)]
pub extern "C" fn hello_staticlib() {}
2 changes: 2 additions & 0 deletions rust/tests/fixtures/native_call/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![expect(unsafe_code, reason = "the fixture exists to call across the C FFI boundary")]

include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
include!(concat!(env!("OUT_DIR"), "/build_probe.rs"));

Expand Down
2 changes: 2 additions & 0 deletions rust/tests/fixtures/native_call/src/native_cc.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![expect(unsafe_code, reason = "the fixture exists to call across the C FFI boundary")]

include!(concat!(env!("OUT_DIR"), "/cc_probe.rs"));

unsafe extern "C" {
Expand Down
2 changes: 2 additions & 0 deletions rust/tests/fixtures/wasm_bindgen/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![expect(unsafe_code, reason = "the fixture exists to call across the C FFI boundary")]

use wasm_bindgen::prelude::*;

pub fn greeting(name: &str) -> String {
Expand Down
Loading