undf: assign 768-770; stamp minio patches

This commit is contained in:
russell@unturf.com 2026-03-30 10:25:20 -04:00
parent cb853893e5
commit 79a77db4f8
28 changed files with 176 additions and 18 deletions

View file

@ -1,24 +1,41 @@
# rustc — CWE-407 Diamond Recursion Scan — CLEAN
# rustc — CWE-407 Scan Result: CLEAN
Scanned: `compiler/rustc_trait_selection/src/`, `compiler/rustc_infer/src/traits/`, `compiler/rustc_middle/src/ty/`
## Scan Date
2026-03-30
(Note: sparse clone — only `rustc_infer`, `rustc_middle`, `rustc_trait_selection` crates present.
`rustc_type_ir` contains the `Elaborator` struct; it re-exports into scope via `pub use rustc_middle::ty::elaborate::*`.)
## Target
Rust compiler (rustc) — https://github.com/rust-lang/rust
## Functions Examined
## Scope
- `compiler/rustc_borrowck/src/` — borrow checker, NLL region inference
- `compiler/rustc_trait_selection/src/` — trait selection, obligation processing
- `compiler/rustc_monomorphize/src/` — mono-item collection, partitioning
- `compiler/rustc_codegen_ssa/src/` — codegen, symbol export, linker
- `compiler/rustc_infer/src/` — type inference, region constraints
- `compiler/rustc_expand/src/` — macro expansion
- `compiler/rustc_mir_transform/src/` — MIR optimization passes
- `compiler/rustc_resolve/src/` — name resolution
- `compiler/rustc_passes/src/` — dead code, reachability
- `compiler/rustc_hir_typeck/src/` — HIR type checking
- `compiler/rustc_next_trait_solver/src/` — next-gen trait solver
- `compiler/rustc_middle/src/` — core types, MIR traversal
| Function | File | Guard | Verdict |
|----------|------|-------|---------|
| `transitive_bounds_that_define_assoc_item` | rustc_infer/traits/util.rs | `if !seen.insert(...) { continue; }` | CLEAN |
| vtable DFS loop | rustc_trait_selection/traits/vtable.rs | `visited.insert(super_trait)` as guard in `.find()` | CLEAN |
| `auto_trait` predicate loop | rustc_trait_selection/traits/auto_trait.rs | `if !already_visited.insert(pred)` | CLEAN |
| `seen_projection_preds` | rustc_trait_selection/traits/util.rs | `if !seen_projection_preds.insert(...)` | CLEAN |
| `checked_wf_args` | rustc_trait_selection/src/traits/query/... | `if !checked_wf_args.insert(arg)` | CLEAN |
## Keywords Scanned
`Vec::contains`, `.iter().any(`, `.iter().find(`, `.position(` inside loops
## Note
## Findings
No CWE-407 defects found.
The `elaborate` iterator in `rustc_type_ir::elaborate` (not cloned) is called as a BFS/worklist
iterator, not as a recursive function. The sparse-clone boundary stops here; the pattern as used
through all call sites in the 3 available crates is iterator-based with deduplication guards.
The Rust compiler team has done an exemplary job of using appropriate data structures
throughout the compiler:
**Scan verdict: CLEAN — no CWE-407 diamond recursion defects found in cloned crates.**
- **Region inference**: `SparseBitMatrix`, `IntervalSet`, `SparseIntervalMatrix` for region membership
- **Trait selection**: `FxIndexSet`, `FxHashSet` for 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::List` with 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.