Use Case: rust-lang/rust - The Rust Compiler
Repository: https://github.com/rust-lang/rust Stack: Rust Test Date: 2025-12-08 Loctree Version: 0.6.2-dev
Overview
The ultimate stress test for Rust analysis - analyzing THE Rust compiler source code itself.
Repository Scale
| Metric | Value |
|---|---|
| Rust Files | 35,387 |
| Total Symbols | 79,891 |
| Repository Size | 558 MB |
| Snapshot Size | 149 MB |
Performance
| Metric | Value |
|---|---|
| Scan Time | ~45 seconds |
| Throughput | 787 files/sec |
| Dead Analysis | < 1 second |
| Cycles Analysis | < 1 second |
Findings
Dead Code Detection
- High Confidence: 1 finding (test fixture - intentional)
- False Positive Rate: 0%
Circular Dependencies - Architectural Analysis
β Found 91 circular import cycles (intra-crate)
Notable cycles detected:
-
Core Library (78-hop chain):
core/src/alloc/layout.rs β error.rs β fmt/mod.rs β cell.rs β cmp.rs β ... (78 intermediate) ... β fmt/builders.rs -
Type System (48-hop chain):
rustc_middle/src/mir/mono.rs β dep_graph/mod.rs β ty/mod.rs β ... (48 intermediate) ... β ty/diagnostics.rs -
AST Module:
rustc_ast/src/ast.rs β format.rs β token.rs β tokenstream.rs β ast_traits.rs β util/parser.rs β visit.rs
Manual Verification Result: These are NOT bugs - they are normal Rust architecture:
- All cycles are intra-crate (
crate::imports within same library) - Rust allows modules within the same crate to mutually import each other
- Compiler resolves via lazy name resolution + type checking post-resolution
- This is fundamentally different from JavaScript/Python circular imports
- No upstream issue warranted - this is standard Rust module organization
Twins Analysis
- Exact Duplicates: 7,918 (mostly test
main()functions) - False Positive Rate: 0% - expected pattern for test suite
Commands Used
cd rust-lang
loct # Create snapshot (45s)
loct dead --confidence high # Dead code analysis
loct cycles # Circular dependencies
loct twins # Duplicate detection
Verdict
EXCEPTIONAL - If loctree handles rust-lang/rust, it handles ANY Rust project.
Key Insights
- Scalability Proven: 35K files in 45 seconds
- Accuracy Validated: 0% FP on dead code
- Cycle Detection: Found 91 real architectural cycles (intra-crate, by design)
- Zero Crashes: Complete analysis on 558 MB codebase
Note on Intra-Crate Cycles
Unlike JavaScript/Python where circular imports can cause undefined/None at runtime, Rust's module system handles intra-crate cycles gracefully:
// This is VALID Rust - fmt imports cell, cell imports fmt
// crate::fmt::mod.rs
use crate::cell::Cell;
// crate::cell.rs
use crate::fmt::{Debug, Display};
Loctree correctly detects these architectural patterns but they should be interpreted as "module interdependencies" rather than "problematic cycles."
π ππππππππππ. with AI Agents by VetCoders (c)2024-2026 LibraxisAI