Skip to content

Add Rust language support — memory safety + ownership validation #11

@rudra496

Description

@rudra496

Summary

Add Rust language support. AI tools frequently generate incorrect Rust code because of its strict ownership/borrowing rules.

Unique Rust patterns to detect

Ownership & Borrowing (AI struggles with these)

  • clone() overuse — AI clones everything instead of borrowing
  • Unnecessary unsafe blocks
  • Raw pointer usage where safe Rust works
  • &mut aliasing violations
  • Missing lifetime annotations

Security

  • unsafe blocks with dangerous operations
  • unwrap() / expect() on user input — panics in production
  • todo!(), unimplemented!() — incomplete code
  • Command injection via std::process::Command
  • Hardcoded secrets

Hallucinations

  • Non-existent crates (cross-reference crates.io popular crates)
  • Invented trait implementations
  • Fake std API methods
  • Wrong derive macros

Logic

  • Dead code from unused variables (Rust compiler catches this, but AI may disable the lint)
  • match arms that are unreachable
  • Incorrect Result/Option handling patterns

Approach

Pattern-based regex analysis. Rust has very consistent syntax which makes this feasible.

Acceptance Criteria

  • .rs files auto-detected and analyzed
  • clone() overuse detection
  • unsafe block analysis
  • unwrap() on user input detection
  • Crate hallucination detection
  • Tests with real AI-generated Rust samples
  • Documentation updated

Difficulty

Advanced — requires understanding of Rust's ownership model to create meaningful checks.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions