Skip to content

Commit f23434e

Browse files
committed
Make term_to_binary on BEAM chunks deterministic
1 parent 4b5ed57 commit f23434e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/elixir/src/elixir_erl.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ get_module_info(Module) ->
286286
exports_md5_info(Struct, Def, Defmacro) ->
287287
%% Deprecations do not need to be part of exports_md5 because it is always
288288
%% checked by the runtime pass, so it is not really part of compilation.
289-
Md5 = erlang:md5(erlang:term_to_binary({Def, Defmacro, Struct})),
289+
Md5 = erlang:md5(term_to_binary({Def, Defmacro, Struct}, [deterministic])),
290290
{clause, 0, [{atom, 0, exports_md5}], [], [elixir_to_erl(Md5)]}.
291291

292292
functions_info(Def) ->
@@ -481,7 +481,7 @@ docs_chunk(Set, Module, Line, Def, Defmacro, Types, Callbacks) ->
481481
ModuleDoc,
482482
ModuleDocMeta,
483483
FunctionDocs ++ MacroDocs ++ CallbackDocs ++ TypeDocs
484-
}, [compressed]),
484+
}, [deterministic, compressed]),
485485

486486
[{<<"Docs">>, DocsChunkData}];
487487

@@ -585,7 +585,7 @@ checker_chunk(#{definitions := Definitions, deprecated := Deprecated, defines_be
585585
exports => lists:sort(behaviour_info_exports(DefinesBehaviour) ++ Exports)
586586
},
587587

588-
[{<<"ExCk">>, erlang:term_to_binary({elixir_checker_v1, Contents})}].
588+
[{<<"ExCk">>, term_to_binary({elixir_checker_v1, Contents}, [deterministic])}].
589589

590590
behaviour_info_exports(true) -> [{{behaviour_info, 1}, #{kind => def, deprecated_reason => nil}}];
591591
behaviour_info_exports(false) -> [].

0 commit comments

Comments
 (0)