Skip to content

Commit

Permalink
loading: prevent module replacement during precompile
Browse files Browse the repository at this point in the history
This is theoretically okay, but unlikely to be intended ever.

(cherry picked from commit d81724a)
  • Loading branch information
vtjnash authored and KristofferC committed Jul 4, 2022
1 parent 8a2374a commit a13e688
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,11 @@ root_module_key(m::Module) = @lock require_lock module_keys[m]
if haskey(loaded_modules, key)
oldm = loaded_modules[key]
if oldm !== m
@warn "Replacing module `$(key.name)`"
if (0 != ccall(:jl_generating_output, Cint, ())) && (JLOptions().incremental != 0)
error("Replacing module `$(key.name)`")
else
@warn "Replacing module `$(key.name)`"
end
end
end
loaded_modules[key] = m
Expand Down

0 comments on commit a13e688

Please sign in to comment.