FFORGE//RS
← Roadmap

rust / LEVEL 3

The user who existed under two spellings

EST.40 MIN
01

THEORY / RETRIEVAL

What to restore

  • State the Hash and Eq invariant required by hash maps
  • Keep tenant identity while matching email with an explicit ASCII policy
  • Use map lookup and replacement without a linear scan

Equal keys must produce equal hashes

HashMap first narrows candidates by hash and then checks equality. Collisions are allowed, so equal hashes do not imply equal keys. The required direction is the opposite: whenever two keys compare equal, their Hash implementations must feed the same bytes in the same order.

Key identity must stay stable while stored

Changing fields that participate in Hash or Eq while a key is inside a map is a logic error. A production boundary usually parses identity into an immutable newtype. This exercise keeps the policy explicit: tenant id is exact and email comparison is ASCII-case-insensitive, not full Unicode normalization.

CHECKPOINT

Which two statements are required for a reliable HashMap key contract?

Select every applicable option. Credit requires an exact set match.

ISOLATED RUST 1.96
src/lib.rsEDIT

02 / CODE REVIEW

Make the code safe

Repair UserKey::hash so it matches the existing ASCII-case-insensitive equality policy. Keep tenant separation, do not allocate a normalized String, and do not replace map operations with a linear scan.

Initializing editor…
CLOUD SANDBOXnetwork off · 256 MB · 12 s
2 / 64 KB
OUTPUT
Runner is waiting for a submission.