Skip to content

Commit edce3a4

Browse files
hyperpolymathclaude
andcommitted
chore: add #![forbid(unsafe_code)] to safe Rust crates
Adds the forbid(unsafe_code) crate-level attribute to all Rust crates that do not use unsafe code, hardening the safety guarantee at compile time. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent bf76be1 commit edce3a4

13 files changed

Lines changed: 13 additions & 0 deletions

File tree

0-ai-gatekeeper-protocol/repo-guardian-fs/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//!
88
//! Universal enforcement for ANY AI agent (not just MCP-compatible).
99
10+
#![forbid(unsafe_code)]
1011
use anyhow::{Context, Result};
1112
use clap::Parser;
1213
use fuse3::path::Session;

a2ml/lsp/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//
88
// Author: Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
99

10+
#![forbid(unsafe_code)]
1011
mod completions;
1112
mod diagnostics;
1213
mod hover;

k9-svc/k9-sign/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
//!
1010
//! Uses ed25519-dalek for cryptographic operations instead of shelling out to OpenSSL.
1111
12+
#![forbid(unsafe_code)]
1213
use anyhow::{Context, Result};
1314
use base64::{engine::general_purpose::STANDARD as BASE64, Engine};
1415
use clap::{Parser, Subcommand};

k9-svc/lsp/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// k9-lsp # Start LSP server on stdin/stdout
1010
// k9-lsp --help # Show usage information
1111

12+
#![forbid(unsafe_code)]
1213
mod completions;
1314
mod diagnostics;
1415
mod hover;

k9-svc/tools/src/k9-init/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// SPDX-License-Identifier: PMPL-1.0-or-later
22
//! k9-init: Scaffold new K9 contractiles from templates
33
4+
#![forbid(unsafe_code)]
45
use anyhow::{Context, Result};
56
use clap::Parser;
67
use dialoguer::{Input, Select};

k9-svc/tools/src/k9-sign/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// SPDX-License-Identifier: PMPL-1.0-or-later
22
//! k9-sign: Sign and verify K9 contractiles with Ed25519
33
4+
#![forbid(unsafe_code)]
45
use anyhow::{Context, Result};
56
use clap::{Parser, Subcommand};
67
use ed25519_dalek::{Signature, Signer, SigningKey, Verifier, VerifyingKey};

k9-svc/tools/src/k9-validate/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// SPDX-License-Identifier: PMPL-1.0-or-later
22
//! k9-validate: Standalone validator for K9 contractiles
33
4+
#![forbid(unsafe_code)]
45
use anyhow::{Context, Result};
56
use clap::Parser;
67
use regex::Regex;

rhodium-standard-repositories/examples/ai-ml-project/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//!
33
//! High-performance inference engine for machine learning models.
44
5+
#![forbid(unsafe_code)]
56
pub mod inference;
67
pub mod model;
78
pub mod preprocessing;

rhodium-standard-repositories/examples/enterprise-service/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//!
33
//! Core library components for the enterprise service.
44
5+
#![forbid(unsafe_code)]
56
pub mod error;
67
pub mod handlers;
78
pub mod models;

rhodium-standard-repositories/examples/minimal-rust-project/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
/// let result = add(2, 3);
1414
/// assert_eq!(result, 5);
1515
/// ```
16+
#![forbid(unsafe_code)]
1617
pub fn add(a: i32, b: i32) -> i32 {
1718
a + b
1819
}

0 commit comments

Comments
 (0)