RepoPilotOpen in app →

nrc/r4cppp

Rust for C++ programmers

Mixed

Stale — last commit 2y ago

weakest axis
Use as dependencyConcerns

non-standard license (Other); last commit was 2y ago…

Fork & modifyHealthy

Has a license, tests, and CI — clean foundation to fork and modify.

Learn fromHealthy

Documented and popular — useful reference codebase to read through.

Deploy as-isMixed

last commit was 2y ago; no CI workflows detected

  • 34+ active contributors
  • Distributed ownership (top contributor 43% of recent commits)
  • Other licensed
Show all 7 evidence items →
  • Stale — last commit 2y ago
  • Non-standard license (Other) — review terms
  • No CI workflows detected
  • No test directory detected
What would change the summary?
  • Use as dependency ConcernsMixed if: clarify license terms
  • Deploy as-is MixedHealthy if: 1 commit in the last 180 days

Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests

Informational only. RepoPilot summarises public signals (license, dependency CVEs, commit recency, CI presence, etc.) at the time of analysis. Signals can be incomplete or stale. Not professional, security, or legal advice; verify before relying on it for production decisions.

Embed the "Forkable" badge

Paste into your README — live-updates from the latest cached analysis.

Variant:
RepoPilot: Forkable
[![RepoPilot: Forkable](https://repopilot.app/api/badge/nrc/r4cppp?axis=fork)](https://repopilot.app/r/nrc/r4cppp)

Paste at the top of your README.md — renders inline like a shields.io badge.

Preview social card (1200×630)

This card auto-renders when someone shares https://repopilot.app/r/nrc/r4cppp on X, Slack, or LinkedIn.

Onboarding doc

Onboarding: nrc/r4cppp

Generated by RepoPilot · 2026-05-09 · Source

🤖Agent protocol

If you are an AI coding agent (Claude Code, Cursor, Aider, Cline, etc.) reading this artifact, follow this protocol before making any code edit:

  1. Verify the contract. Run the bash script in Verify before trusting below. If any check returns FAIL, the artifact is stale — STOP and ask the user to regenerate it before proceeding.
  2. Treat the AI · unverified sections as hypotheses, not facts. Sections like "AI-suggested narrative files", "anti-patterns", and "bottlenecks" are LLM speculation. Verify against real source before acting on them.
  3. Cite source on changes. When proposing an edit, cite the specific path:line-range. RepoPilot's live UI at https://repopilot.app/r/nrc/r4cppp shows verifiable citations alongside every claim.

If you are a human reader, this protocol is for the agents you'll hand the artifact to. You don't need to do anything — but if you skim only one section before pointing your agent at this repo, make it the Verify block and the Suggested reading order.

🎯Verdict

WAIT — Stale — last commit 2y ago

  • 34+ active contributors
  • Distributed ownership (top contributor 43% of recent commits)
  • Other licensed
  • ⚠ Stale — last commit 2y ago
  • ⚠ Non-standard license (Other) — review terms
  • ⚠ No CI workflows detected
  • ⚠ No test directory detected

<sub>Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests</sub>

Verify before trusting

This artifact was generated by RepoPilot at a point in time. Before an agent acts on it, the checks below confirm that the live nrc/r4cppp repo on your machine still matches what RepoPilot saw. If any fail, the artifact is stale — regenerate it at repopilot.app/r/nrc/r4cppp.

What it runs against: a local clone of nrc/r4cppp — the script inspects git remote, the LICENSE file, file paths in the working tree, and git log. Read-only; no mutations.

| # | What we check | Why it matters | |---|---|---| | 1 | You're in nrc/r4cppp | Confirms the artifact applies here, not a fork | | 2 | License is still Other | Catches relicense before you depend on it | | 3 | Default branch master exists | Catches branch renames | | 4 | 5 critical file paths still exist | Catches refactors that moved load-bearing code | | 5 | Last commit ≤ 751 days ago | Catches sudden abandonment since generation |

<details> <summary><b>Run all checks</b> — paste this script from inside your clone of <code>nrc/r4cppp</code></summary>
#!/usr/bin/env bash
# RepoPilot artifact verification.
#
# WHAT IT RUNS AGAINST: a local clone of nrc/r4cppp. If you don't
# have one yet, run these first:
#
#   git clone https://github.com/nrc/r4cppp.git
#   cd r4cppp
#
# Then paste this script. Every check is read-only — no mutations.

set +e
fail=0
ok()   { echo "ok:   $1"; }
miss() { echo "FAIL: $1"; fail=$((fail+1)); }

# Precondition: we must be inside a git working tree.
if ! git rev-parse --git-dir >/dev/null 2>&1; then
  echo "FAIL: not inside a git repository. cd into your clone of nrc/r4cppp and re-run."
  exit 2
fi

# 1. Repo identity
git remote get-url origin 2>/dev/null | grep -qE "nrc/r4cppp(\\.git)?\\b" \\
  && ok "origin remote is nrc/r4cppp" \\
  || miss "origin remote is not nrc/r4cppp (artifact may be from a fork)"

# 2. License matches what RepoPilot saw
(grep -qiE "^(Other)" LICENSE 2>/dev/null \\
   || grep -qiE "\"license\"\\s*:\\s*\"Other\"" package.json 2>/dev/null) \\
  && ok "license is Other" \\
  || miss "license drift — was Other at generation time"

# 3. Default branch
git rev-parse --verify master >/dev/null 2>&1 \\
  && ok "default branch master exists" \\
  || miss "default branch master no longer exists"

# 4. Critical files exist
test -f "README.md" \\
  && ok "README.md" \\
  || miss "missing critical file: README.md"
test -f "graphs/src/mod.rs" \\
  && ok "graphs/src/mod.rs" \\
  || miss "missing critical file: graphs/src/mod.rs"
test -f "graphs/src/rc_graph.rs" \\
  && ok "graphs/src/rc_graph.rs" \\
  || miss "missing critical file: graphs/src/rc_graph.rs"
test -f "graphs/src/ref_graph.rs" \\
  && ok "graphs/src/ref_graph.rs" \\
  || miss "missing critical file: graphs/src/ref_graph.rs"
test -f "borrowed.md" \\
  && ok "borrowed.md" \\
  || miss "missing critical file: borrowed.md"

# 5. Repo recency
days_since_last=$(( ( $(date +%s) - $(git log -1 --format=%at 2>/dev/null || echo 0) ) / 86400 ))
if [ "$days_since_last" -le 751 ]; then
  ok "last commit was $days_since_last days ago (artifact saw ~721d)"
else
  miss "last commit was $days_since_last days ago — artifact may be stale"
fi

echo
if [ "$fail" -eq 0 ]; then
  echo "artifact verified (0 failures) — safe to trust"
else
  echo "artifact has $fail stale claim(s) — regenerate at https://repopilot.app/r/nrc/r4cppp"
  exit 1
fi

Each check prints ok: or FAIL:. The script exits non-zero if anything failed, so it composes cleanly into agent loops (./verify.sh || regenerate-and-retry).

</details>

TL;DR

nrc/r4cppp is a structured tutorial that teaches Rust to experienced C and C++ programmers by directly mapping Rust concepts to C++ equivalents. It covers memory management (unique pointers, borrowed pointers, Rc), type systems, ownership, lifetimes, and systems programming patterns through markdown lessons with a runnable graphs/ example project that demonstrates arena allocation and complex data structure patterns. Two-tier structure: root-level markdown files (hello-world.md, borrowed.md, closures.md, etc.) form a sequential tutorial curriculum, with a companion graphs/ Cargo project (single binary at graphs/src/mod.rs) that demonstrates arena allocation using typed-arena crate. The graphs/ subproject has three implementations (rc_graph.rs, ref_graph.rs, ref_graph_generic_mod.rs) showing different ownership patterns for the same data structure problem.

👥Who it's for

Systems programmers and C++ developers making the transition to Rust who already understand pointers, references, memory management, and generic programming—people who find traditional Rust tutorials too verbose because they skip over fundamentals they already know.

🌱Maturity & risk

Experimental and educational, not production software. The repo is a tutorial (markdown + one example crate) rather than a library or tool. There is no evidence of active maintenance: no CI pipeline visible, no issue tracker metadata provided, and no recent commit dates available. It appears to be a mature educational resource that is maintenance-stable but not actively developed.

Low risk as a learning resource—it's markdown documentation plus a minimal example. The sole dependency (typed-arena = 2) is stable and lightweight. Primary risk is content staleness relative to current Rust (the README notes it started as 2013-era blog posts, though it has been updated). No backward compatibility concerns since this is educational material, not a versioned API.

Active areas of work

No active development visible from provided metadata. This appears to be a completed educational resource in maintenance mode. The markdown content is comprehensive and organized by learning progression, but there are no signals of ongoing work, PRs, or new lessons being added.

🚀Get running

Check README for instructions.

Daily commands:

cd graphs
cargo build          # debug build
cargo build --release  # optimized
cargo run --release

The lesson files are not runnable; they contain code snippets and explanations intended to be read sequentially starting from hello-world.md.

🗺️Map of the codebase

  • README.md — Entry point explaining the tutorial's scope, target audience (C++ programmers), and philosophy—essential for understanding why this codebase exists and its pedagogical approach.
  • graphs/src/mod.rs — Main binary entry point for the graphs example, demonstrating practical Rust ownership and borrowing patterns that are central to the tutorial's message.
  • graphs/src/rc_graph.rs — Reference-counted graph implementation showing Rc<RefCell<T>> patterns, a critical bridge between C++ manual memory management and Rust's safety guarantees.
  • graphs/src/ref_graph.rs — Borrowed-reference graph implementation demonstrating lifetime annotations and borrowing rules, core concepts this tutorial teaches.
  • borrowed.md — Detailed explanation of Rust's borrowing system—likely the most critical conceptual bridge for C++ developers unfamiliar with lifetimes.
  • data-types.md — Covers Rust primitive and composite types with C++ comparisons, foundational knowledge for following the rest of the tutorial.
  • control-flow.md — Control flow constructs and pattern matching, core language features that differ semantically from C++ despite syntactic similarity.

🧩Components & responsibilities

  • Borrowed-reference graph (ref_graph.rs) (Rust lifetimes, references, impl blocks) — Graph implementation using lifetime annotations and borrowed references; demonstrates Rust's core borrow checker in action.
    • Failure mode: Compiler rejects if references outlive the graph structure or if multiple mutable borrows are attempted—intended, as this teaches the rules.
  • Rc<RefCell<T>> graph (rc_graph.rs) (Rc (reference counting), RefCell (interior mutability), runtime_borrow_check) — Reference-counted, interior-mutability graph allowing flexible mutable access at the cost of runtime overhead and potential panics on borrow conflicts.
    • Failure mode: Runtime panic if borrow rules are violated after checking; heap fragmentation if many nodes are allocated separately.
  • Generic lifetime graph (ref_graph_generic_mod.rs) (Generics, trait bounds, lifetime parameters) — Parameterized graph implementation allowing lifetime-based borrowing with customizable node and edge types.
    • Failure mode: Compile-time errors if trait bounds or lifetimes are not satisfied; less flexible than Rc but stricter guarantees.
  • Tutorial markdown documents (Markdown, code examples) — Educational prose bridging C++ concepts to Rust equivalents; primary learning material.
    • Failure mode: Outdated examples or unclear explan

🛠️How to make changes

Add a New Tutorial Lesson

  1. Create a new markdown file (e.g., generics.md) in the root directory following the naming convention of existing lessons. (generics.md)
  2. Structure the lesson with a C++ analogy in the first section, then explain the Rust equivalent with code examples. (generics.md)
  3. Add a link to the new lesson in the contents section of README.md in the appropriate position (topic grouping). (README.md)
  4. If including runnable code, add an example binary to graphs/src/ and update graphs/src/mod.rs to expose it. (graphs/src/mod.rs)

Add a New Graph Implementation Strategy

  1. Create a new file in graphs/src/ (e.g., arena_graph.rs) implementing the Graph trait with your ownership strategy. (graphs/src/arena_graph.rs)
  2. Define public struct and impl blocks that construct and operate on the graph, following the pattern of ref_graph.rs or rc_graph.rs. (graphs/src/arena_graph.rs)
  3. Add a mod declaration in graphs/src/mod.rs and conditionally compile/select the implementation via command-line flag or hardcoded choice. (graphs/src/mod.rs)
  4. Update graphs/README.md to describe the new strategy, its pros/cons, and when it is preferable to other approaches. (graphs/README.md)

Add a Comparison with C++ Pattern

  1. Open an existing tutorial markdown file where the C++ pattern is relevant (e.g., borrowed.md for references). (borrowed.md)
  2. Add a new subsection with C++ code example and equivalent Rust code, clearly labeling the differences and how Rust enforces safety. (borrowed.md)
  3. If demonstrating a non-obvious pattern, consider adding a minimal runnable example to graphs/src/ and link to it. (graphs/src/mod.rs)

🔧Why these technologies

  • Markdown for tutorials — Lightweight, version-controllable, renders natively on GitHub, and provides clear separation between prose explanation and runnable code.
  • Rust for examples — The target language; using Rust code ensures examples are idiomatic, compile-checked, and reinforce the exact syntax and compiler feedback learners will encounter.
  • typed-arena (dependency) — Demonstrates non-standard memory management approaches (arena allocation) as an alternative to Rc/RefCell, broadening the mental model for C++ systems programmers.
  • Cargo for project management — Standard Rust build system; using it in the examples teaches practical workflows that learners will use in real projects.

⚖️Trade-offs already made

  • Multiple graph implementations (borrowed, Rc, generic) in a single example

    • Why: Demonstrates that Rust allows multiple ownership strategies for the same abstract structure, important for C++ developers who may only know one pattern.
    • Consequence: Increased complexity in graphs/src/mod.rs; readers must understand which strategy is active and why one is chosen over another.
  • Markdown lessons rather than interactive REPL/playground

    • Why: Offline-accessible, archival-friendly, integrates naturally into GitHub documentation flow.
    • Consequence: Readers must set up local Rust environment to experiment; no immediate feedback loop within the tutorial itself.
  • Assuming prior C/C++ knowledge

    • Why: Reduces cognitive load by skipping fundamentals (what is a pointer, stack vs heap) and focusing on Rust-specific concepts.
    • Consequence: Inaccessible to programmers without systems programming background; may not serve as first-language-learning resource.

🚫Non-goals (don't propose these)

  • Comprehensive Rust standard library reference—this is a conceptual bridge, not API documentation
  • Production-ready graph library—examples prioritize pedagogical clarity over performance or feature completeness
  • Real-time interactive learning environment—no REPL, debugger, or live coding interface
  • Coverage of async/await, macros, or proc-derive—focuses on core ownership and borrow semantics
  • Windows or embedded systems support—implicitly assumes Unix-like development environment

🪤Traps & gotchas

PDF compilation: compile_pdf.sh requires external dependencies (pandoc, probably LaTeX) not declared in Cargo.toml—only relevant if you want to build the PDF version. Arena lifetime: The graphs/ example uses typed-arena which requires understanding that arena-allocated objects have lifetimes tied to the arena—a common pain point for newcomers. Generic lifetimes: graphs/src/ref_graph_generic_mod.rs uses complex lifetime annotations that may not be immediately obvious without reading the tutorial sequentially first.

🏗️Architecture

💡Concepts to learn

  • Ownership and Move Semantics — Rust's ownership system (linear types) is the core difference from C++; understanding moves vs copies is prerequisite for understanding why the borrow checker works
  • Lifetimes and Borrow Checking — The borrow checker enforces lifetime correctness at compile-time via explicit lifetime annotations; this tutorial teaches how to read and write them for C++ programmers
  • Smart Pointers: Box<T>, Rc<T>, RefCell<T> — Direct analogs to C++'s unique_ptr, shared_ptr, and interior mutability patterns; essential for understanding when borrowing isn't sufficient
  • Arena Allocation (Typed Arena) — The graphs/ example demonstrates pre-allocating memory pools for groups of objects—a performance pattern familiar to C++ systems programmers but less idiomatic in higher-level languages
  • Trait Objects and Dynamic Dispatch — Rust's equivalent of virtual functions and inheritance; critical for polymorphism without generics, though not deeply covered in this tutorial (good gap to understand)
  • Destructuring and Pattern Matching — The destructuring.md and destructuring-2.md lessons cover Rust's powerful pattern syntax for decomposing types—more expressive than C++ structured bindings (C++17)
  • Closure Capture and Trait Bounds (Fn, FnMut, FnOnce) — Rust closures are typed by capture semantics; understanding Fn vs FnMut vs FnOnce is essential for functional patterns and avoids unexpected borrow-checker errors
  • rust-lang/rustlings — Small guided Rust exercises for beginners; complementary hands-on practice to nrc/r4cppp's concept-focused approach
  • nrc/unicode-rs — Real systems programming in Rust by the same author; shows patterns this tutorial teaches in production code
  • ferrous-systems/teaching-material — Another systems Rust curriculum; good cross-reference for alternative explanations of ownership and lifetimes
  • rust-lang/book — The official Rust Book—broader in scope, but the go-to reference for concepts this tutorial only introduces
  • jonhoo/rust-types — Deep dives into type system intricacies from a C++ perspective; companion for readers who want to understand type theory behind Rust's constraints

🪄PR ideas

To work on one of these in Claude Code or Cursor, paste: Implement the "<title>" PR idea from CLAUDE.md, working through the checklist as the task list.

Add runnable examples and tests for graphs/ module code samples

The graphs/ directory contains Rust code (rc_graph.rs, ref_graph.rs, ref_graph_generic_mod.rs) that likely demonstrates memory management patterns relevant to C++ programmers, but there are no visible tests or example binaries. Adding integration tests and executable examples would help readers verify the code works and understand practical applications of the concepts taught in borrowed.md, rc-raw.md, and unique.md.

  • [ ] Create tests/ directory in graphs/ with integration tests for each graph implementation
  • [ ] Add separate example binaries in graphs/examples/ for rc_graph.rs and ref_graph.rs with realistic usage patterns
  • [ ] Update graphs/Cargo.toml to include [[example]] entries for each example binary
  • [ ] Update graphs/README.md with instructions on running examples and tests

Add compile_pdf.sh support and document PDF generation workflow

The compile_pdf.sh script exists but there's no documentation on how to build the tutorial as a PDF, required dependencies, or whether it's actively maintained. This is valuable since the repo targets systems programmers who may want offline documentation. Documentation clarity would reduce contributor friction.

  • [ ] Review and update compile_pdf.sh to ensure it works with current Markdown files
  • [ ] Create BUILDING.md documenting PDF generation prerequisites (pandoc, wkhtmltopdf versions, etc.)
  • [ ] Add a GitHub Action workflow (.github/workflows/pdf-build.yml) to validate the PDF generation on commits
  • [ ] Update README.md with a link to BUILDING.md and instructions for generating the PDF locally

Create missing tutorial chapter: "Memory Management Comparison - Rust vs C++"

The tutorial has chapters on borrowed references, rc-raw, and unique pointers, but no consolidated chapter directly comparing Rust's ownership model to C++ memory management patterns (RAII, smart pointers, const correctness). This would be high-value for the target audience and there's no file addressing this gap directly.

  • [ ] Create memory-management-comparison.md covering: Rust ownership vs C++ RAII, rc/Arc vs shared_ptr, unique vs unique_ptr, and borrowing vs const references
  • [ ] Cross-reference this new chapter from borrowed.md, rc-raw.md, and unique.md
  • [ ] Add the new file to the contents section in README.md
  • [ ] Include 2-3 side-by-side code examples showing equivalent C++ and Rust patterns

🌿Good first issues

  • Add a data-structures.md lesson covering Box<T> vs Rc<T> trade-offs with side-by-side C++ smart pointer comparisons, since the current content jumps from unique pointers to Rc without explicit comparison
  • Create a fourth implementation in graphs/src/ using std::arena or a custom bump allocator (when stable) to show alternatives to typed-arena, with docs in graphs/README.md
  • Write integration tests in graphs/tests/ that verify the three graph implementations (rc_graph, ref_graph, ref_graph_generic) produce identical results for the same input to help readers trust the implementations are equivalent

Top contributors

Click to expand

📝Recent commits

Click to expand
  • 3cea93b — Merge pull request #149 from luis4a0/patch-1 (nrc)
  • 8b49714 — Fix install link (luis4a0)
  • bedf515 — Merge pull request #144 from synecdoche/typedarena_crate (nrc)
  • 8067dd1 — Use typed-arena crate in graphs example. (synecdoche)
  • 990f71b — Merge pull request #147 from daverigby/master-1 (nrc)
  • 31d1e8f — Update primitives.md: fix typo in example (daverigby)
  • b9c33c0 — use typed-arena crate (synecdoche)
  • 0710e71 — Merge pull request #143 from xris1658/patch-1 (nrc)
  • f99d31a — Remove extra ' (xris1658)
  • 22e9834 — Merge pull request #141 from marcin-serwin/github-footnotes (nrc)

🔒Security observations

This is an educational Rust tutorial repository with minimal external dependencies, presenting a low overall security risk. The primary codebase consists of markdown documentation and simple example code. No critical vulnerabilities, hardcoded secrets, injection risks, or infrastructure misconfigurations were detected. Minor recommendations include updating the typed-arena dependency to the latest version and adding an MSRV declaration for better compatibility management. The repository's educational nature and limited scope significantly reduce the attack surface.

  • Low · Outdated typed-arena Dependency — graphs/Cargo.toml. The typed-arena dependency is pinned to version 2, which may be outdated. While this is an educational repository (Rust tutorial), using the latest stable version ensures security patches and bug fixes are included. Fix: Update typed-arena to the latest version by running 'cargo update' or specify a more flexible version constraint like 'typed-arena = "2.0"' to allow patch updates.
  • Low · Missing MSRV (Minimum Supported Rust Version) — graphs/Cargo.toml. The Cargo.toml does not specify a Minimum Supported Rust Version (MSRV). This could lead to builds failing with older Rust versions if dependencies update incompatibly. Fix: Add 'rust-version' field to Cargo.toml specifying the minimum supported Rust version (e.g., 'rust-version = "1.56"').
  • Low · Compilation Script Without Input Validation — compile_pdf.sh. The compile_pdf.sh script exists in the repository but its contents were not provided for analysis. Shell scripts without proper input validation and error handling can be security risks. Fix: Review the script for proper error handling, input validation, and safe command execution patterns. Ensure no arbitrary command injection is possible.

LLM-derived; treat as a starting point, not a security audit.


Generated by RepoPilot. Verdict based on maintenance signals — see the live page for receipts. Re-run on a new commit to refresh.

Mixed signals · nrc/r4cppp — RepoPilot