sb-dev/openquant / .agents/skills/rust-review
rust-review
VerifiedReview Rust crates, services, or libraries for safe/unsafe boundary issues, memory safety, concurrency hazards, panic-induced denial of service, FFI safety, and async runtime mistakes. Use for a Rust security audit, especially unsafe, FFI, or concurrent code.
upstream/prompts/general/deprecated-api-finder.md
View on GitHub---
name: deprecated-api-finder
description: Detects deprecated unsafe-adjacent APIs (mem::uninitialized, std::intrinsics::*, etc.)
---
**Finding ID Prefix:** `DEPRECAPI`.
**Gates:**
1. Call to `mem::uninitialized::<T>()` — genuinely deprecated since Rust 1.39 (use `MaybeUninit`). This is the canonical in-scope target.
2. Use of `std::intrinsics::*` or `#![feature(core_intrinsics)]` — not "deprecated", but it pins the crate to a **nightly** toolchain (it cannot compile on stable); flag as a portability/hygiene concern.
**Out of scope** (do NOT flag here):
- `mem::zeroed` is **not** deprecated. Zeroing a type with no valid all-zero representation (`NonNull`, references, many enums) is an *invalid-value* soundness bug that belongs to the `uninitialized-read` (UNINITREAD) pass, not this one. (Note: `bool` is **not** such a type — its all-zero byte is `false`, so `mem::zeroed::<bool>()` is sound; `bool`'s hazard is an *arbitrary* non-`0`/`1` byte, not zeroing.)
- `*const ()` / `*mut ()` are idiomatic type-erased pointers (FFI handles, vtable erasure), not deprecated APIs.
**FPs to reject:** occurrences inside string literals/comments, or in `#[cfg(test)]` fixtures. A `#[allow(deprecated)]` annotation clears only the *deprecation* aspect (DEPRECAPI) — it does **not** clear the underlying soundness bug: `#[allow(deprecated)] mem::uninitialized::<T>()` for a `T` with no valid uninit representation is still UB (rustc's `invalid_value` lint still fires), which the `uninitialized-read` (UNINITREAD) pass must still report. So treat `#[allow(deprecated)]` as suppressing the DEPRECAPI finding only, never the invalid-value/UB concern.
**Search patterns:**
```
\bmem::uninitialized\b|\bstd::mem::uninitialized\b
core::intrinsics::|std::intrinsics::|feature\(core_intrinsics\)
```
**Patch:** migrate `mem::uninitialized` to `MaybeUninit`; replace nightly intrinsics with their stabilized equivalents (or document the nightly requirement).
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |