Skip to content

Add Rust language documentation#149

Open
mahendrashelke wants to merge 2 commits intoandrewyng:mainfrom
mahendrashelke:add-rust-language-docs
Open

Add Rust language documentation#149
mahendrashelke wants to merge 2 commits intoandrewyng:mainfrom
mahendrashelke:add-rust-language-docs

Conversation

@mahendrashelke
Copy link

@mahendrashelke mahendrashelke commented Mar 19, 2026

Summary

  • Adds LLM-optimized Rust language guide at content/rust-lang/docs/rust/rust/DOC.md
  • Covers common AI agent pitfalls: pattern matching, numeric casting, checked arithmetic, ownership/borrowing, error handling, enums for domain logic, concurrency, and edition 2024 changes
  • Incorporates security patterns from Pitfalls of Safe Rust: TOCTOU, constant-time comparison, unbounded input, cargo-geiger
  • Incorporates bad habits from Bad Habits from Other Languages
  • 394 lines, validates clean with chub build --validate-only
  • Pure Rust std library — no external crate dependencies in examples

Test plan

  • node cli/bin/chub build content/ --validate-only passes (1554 docs, 0 warnings)
  • Frontmatter follows CONTRIBUTING.md format
  • Under 500 line limit

Covers common AI agent pitfalls: pattern matching, numeric casting, checked
arithmetic, ownership/borrowing, error handling, enums for domain logic,
and security patterns from corrode.dev's "Pitfalls of Safe Rust".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 19, 2026 03:38
@mahendrashelke
Copy link
Author

cc @rohitprasad15 — would appreciate a review when you get a chance!

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Rust language guideline document intended to reduce common incorrect patterns produced by AI agents, with emphasis on ownership/borrowing, error handling, safety/security pitfalls, concurrency, and edition 2024 notes.

Changes:

  • Introduces a Rust language guidelines doc with “golden rules” and common pitfalls.
  • Adds security-focused guidance (TOCTOU, constant-time comparison, unbounded input) and unsafe-code hygiene tips.
  • Includes examples covering error handling, domain modeling with enums, and basic stdlib concurrency.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants