Skip to content
  • Rodrigo Mesquita's avatar
    a1e42e7a
    hi: Deterministic ImportedMods in Usages · a1e42e7a
    Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
    The `mi_usages` field of the interface files must use a deterministic
    list of `Usage`s to guarantee a deterministic interface. However, this
    list was, in its origins, constructed from a `ModuleEnv` which uses a
    non-deterministic ordering that was leaking into the interface.
    
    Specifically, ImportedMods = ModuleEnv ... would get converted to a list and
    then passed to `mkUsageInfo` to construct the Usages.
    
    The solution is simple. Back `ImportedMods` with a deterministic map.
    `Map Module ...` is enough, since the Ord instance for `Module` already
    uses a stable, deterministic, comparison.
    
    Fixes #25131
    a1e42e7a
    hi: Deterministic ImportedMods in Usages
    Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
    The `mi_usages` field of the interface files must use a deterministic
    list of `Usage`s to guarantee a deterministic interface. However, this
    list was, in its origins, constructed from a `ModuleEnv` which uses a
    non-deterministic ordering that was leaking into the interface.
    
    Specifically, ImportedMods = ModuleEnv ... would get converted to a list and
    then passed to `mkUsageInfo` to construct the Usages.
    
    The solution is simple. Back `ImportedMods` with a deterministic map.
    `Map Module ...` is enough, since the Ord instance for `Module` already
    uses a stable, deterministic, comparison.
    
    Fixes #25131
Loading