java-topology/tools/tickets/defects/rustc-0001.md
russell@unturf.com db29a08762 undefect. CWE-407 — 92 sites, 42 ecosystems
B&W print-friendly diagrams + tinkerpop-0001 + wave-3 proof sections.
Squash of 94 local commits onto remote master.
2026-03-26 19:48:18 -04:00

1.2 KiB

id repo severity status created patched patch
rustc-0001 rust HIGH PATCHED 2026-03-23 2026-03-23 defects/rustc/patch/rustc-0001-0002-evalstack-swapremove.patch

Defect

File: compiler/rustc_middle/src/ty/inhabitedness/inhabited_predicate.rs:109,127 Pattern: SmallVec::contains in match exhaustiveness checking Complexity: O(d²) Language: Rust

Description

Match exhaustiveness checking uses SmallVec::contains to test whether a type has already been seen during recursive inhabitedness analysis. SmallVec::contains performs a linear scan over all stored elements. With d types encountered during recursive descent, each requiring a membership check against all previously seen types, the total cost is O(d²) in recursion depth.

Fix

Replace: seen.contains(&ty) With: seen_set.contains(&ty) Data structure change: SmallVec<[Ty; 8]> seen → FxHashSet<Ty> seen_set

Work required

  • Patch in defects/rustc/patch/
  • Unit test — asserts exact operation counts before/after (in defects/rustc/unit/)
  • Integration test (in defects/rustc/integration/)
  • Benchmark — before/after on V=100,200,400,800 (in defects/rustc/bench/)
  • White paper section