Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions stdlib/Artifacts/src/Artifacts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -659,10 +659,10 @@ macro artifact_str(name, platform=nothing, artifacts_toml_path=nothing)
srcfile = pwd()
end
# Sometimes we know the exact path to the Artifacts.toml file, so we can save some lookups
local artifacts_toml = if artifacts_toml_path === nothing
local artifacts_toml = if artifacts_toml_path === nothing || artifacts_toml_path == :(nothing)
find_artifacts_toml(srcfile)
else
artifacts_toml_path
eval(artifacts_toml_path)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you try this @staticfloat? It seems to error for me:

In [3]: using Vulkan_Headers_jll
[ Info: Precompiling Vulkan_Headers_jll [8d446b21-f3ad-5576-a034-752265b9b6f9]
ERROR: LoadError: Evaluation into the closed module `Artifacts` breaks incremental compilation because the side effects will not be permanent. This is likely due to some other module mutating `Artifacts` with `eval` during precompilation - don't do this.
Stacktrace:
 [1] eval
   @ ./boot.jl:370 [inlined]
 [2] eval(x::String)
   @ Artifacts ~/julia/usr/share/julia/stdlib/v1.9/Artifacts/src/Artifacts.jl:3
 [3] var"@artifact_str"(__source__::LineNumberNode, __module__::Module, name::Any, platform::Any, artifacts_toml_path::Any)
   @ Artifacts ~/julia/usr/share/julia/stdlib/v1.9/Artifacts/src/Artifacts.jl:665

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I only tried it with the test set, which doesn't hit this error, apparently. @vtjnash what is the correct fix here? I don't really understand how to properly "get" the value of a string at compile-time I guess.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was it that failed before this change? I tried it with JLLWrappers and it seemed to work ok without the eval.

end
if artifacts_toml === nothing
error(string(
Expand Down Expand Up @@ -693,7 +693,7 @@ macro artifact_str(name, platform=nothing, artifacts_toml_path=nothing)

# If `name` is a constant, (and we're using the default `Platform`) we can actually load
# and parse the `Artifacts.toml` file now, saving the work from runtime.
if isa(name, AbstractString) && platform === nothing
if isa(name, AbstractString) && (platform === nothing || platform == :(nothing))
# To support slash-indexing, we need to split the artifact name from the path tail:
platform = HostPlatform()
artifact_name, artifact_path_tail, hash = artifact_slash_lookup(name, artifact_dict, artifacts_toml, platform)
Expand Down