Skip to content

Commit 3f4eda6

Browse files
authored
Libdl: Store path contents as Tuple instead of Vector (#57734)
This makes `LazyLibraryPath` eligible for const-prop, which is important so that we can inline/infer `string(::LazyLibraryPath)` at compile-time if the argument is a (global) `const`. Otherwise, this code is not infer-able without something like TypedCallable to make the interface requirements explicit.
1 parent fe99e44 commit 3f4eda6

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

base/libdl.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,10 +330,9 @@ libfoo = LazyLibrary(LazyLibraryPath(prefix, "lib/libfoo.so.1.2.3"))
330330
```
331331
"""
332332
struct LazyLibraryPath
333-
pieces::Vector
334-
LazyLibraryPath(pieces::Vector) = new(pieces)
333+
pieces::Tuple{Vararg{Any}}
334+
LazyLibraryPath(pieces...) = new(pieces)
335335
end
336-
LazyLibraryPath(args...) = LazyLibraryPath(collect(args))
337336
Base.string(llp::LazyLibraryPath) = joinpath(String[string(p) for p in llp.pieces])
338337
Base.cconvert(::Type{Cstring}, llp::LazyLibraryPath) = Base.cconvert(Cstring, string(llp))
339338
# Define `print` so that we can wrap this in a `LazyString`

0 commit comments

Comments
 (0)