1.9 KiB
1.9 KiB
rustc — CWE-407 Scan Result: CLEAN
Scan Date
2026-03-30
Target
Rust compiler (rustc) — https://github.com/rust-lang/rust
Scope
compiler/rustc_borrowck/src/— borrow checker, NLL region inferencecompiler/rustc_trait_selection/src/— trait selection, obligation processingcompiler/rustc_monomorphize/src/— mono-item collection, partitioningcompiler/rustc_codegen_ssa/src/— codegen, symbol export, linkercompiler/rustc_infer/src/— type inference, region constraintscompiler/rustc_expand/src/— macro expansioncompiler/rustc_mir_transform/src/— MIR optimization passescompiler/rustc_resolve/src/— name resolutioncompiler/rustc_passes/src/— dead code, reachabilitycompiler/rustc_hir_typeck/src/— HIR type checkingcompiler/rustc_next_trait_solver/src/— next-gen trait solvercompiler/rustc_middle/src/— core types, MIR traversal
Keywords Scanned
Vec::contains, .iter().any(, .iter().find(, .position( inside loops
Findings
No CWE-407 defects found.
The Rust compiler team has done an exemplary job of using appropriate data structures throughout the compiler:
- Region inference:
SparseBitMatrix,IntervalSet,SparseIntervalMatrixfor region membership - Trait selection:
FxIndexSet,FxHashSetfor auto-trait dedup - Monomorphize collector:
UnordSet(hash-based) for visited tracking - Borrow checker:
BitSet-based containers throughout - Inline history: bounded by
HISTORY_DEPTH_LIMIT = 20 - Dead code analysis:
LocalDefIdSet(hash-based) for live symbols - Fudge inference:
Range<T>::contains(O(1) range check, not linear scan) - Defining opaque types:
ty::Listwith O(N) contains, but N is always small (opaque types in a function body)
Every hot-path membership test uses a hash-based, bit-set, or interval-set data structure.