Skip to content

Commit 6a8e00b

Browse files
authored
Merge branch 'master' into vc/excise_random
2 parents c581d7c + eaef647 commit 6a8e00b

File tree

253 files changed

+4459
-2188
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

253 files changed

+4459
-2188
lines changed

Make.inc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,10 @@ USE_MLIR := 0
359359
# Options to use RegionVectorizer
360360
USE_RV := 0
361361

362+
# Use `ccache` for speeding up recompilation of the C/C++ part of Julia.
363+
# Requires the `ccache` executable to be in the `PATH` environment variable.
364+
USECCACHE := 0
365+
362366
# Cross-compile
363367
#XC_HOST := i686-w64-mingw32
364368
#XC_HOST := x86_64-w64-mingw32
@@ -595,10 +599,13 @@ CPP_STDOUT := $(CPP) -P
595599
# file extensions
596600
ifeq ($(OS), WINNT)
597601
SHLIB_EXT := dll
602+
PATHSEP := ;
598603
else ifeq ($(OS), Darwin)
599604
SHLIB_EXT := dylib
605+
PATHSEP := :
600606
else
601607
SHLIB_EXT := so
608+
PATHSEP := :
602609
endif
603610

604611
ifeq ($(OS),WINNT)

NEWS.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ New language features
66
* `public` is a new keyword. Symbols marked with `public` are considered public
77
API. Symbols marked with `export` are now also treated as public API. The
88
difference between `public` and `export` is that `public` names do not become
9-
available when `using` a package/module. ([#50105])
9+
available when `using` a package/module ([#50105]).
1010
* `ScopedValue` implement dynamic scope with inheritance across tasks ([#50958]).
1111
* The new macro `Base.Cartesian.@ncallkw` is analogous to `Base.Cartesian.@ncall`,
1212
but allows to add keyword arguments to the function call ([#51501]).
@@ -19,6 +19,10 @@ New language features
1919

2020
Language changes
2121
----------------
22+
* During precompilation, the `atexit` hooks now run before saving the output file. This
23+
allows users to safely tear down background state (such as closing Timers and sending
24+
disconnect notifications to heartbeat tasks) and cleanup other resources when the program
25+
wants to begin exiting.
2226

2327
Compiler/Runtime improvements
2428
-----------------------------
@@ -34,7 +38,7 @@ Command-line option changes
3438
(i.e. using `julia script.jl` or `julia -e expr`), julia will subsequently run the `Main.main` function automatically.
3539
This is intended to unify script and compilation workflows, where code loading may happen
3640
in the compiler and execution of `Main.main` may happen in the resulting executable. For interactive use, there is no semantic
37-
difference between defining a `main` function and executing the code directly at the end of the script. ([50974])
41+
difference between defining a `main` function and executing the code directly at the end of the script ([50974]).
3842

3943
Multi-threading changes
4044
-----------------------
@@ -46,29 +50,31 @@ New library functions
4650
---------------------
4751

4852
* The new `Libc.mkfifo` function wraps the `mkfifo` C function on Unix platforms ([#34587]).
49-
* `hardlink(src, dst)` can be used to create hard links. ([#41639])
50-
* `diskstat(path=pwd())` can be used to return statistics about the disk. ([#42248])
53+
* `hardlink(src, dst)` can be used to create hard links ([#41639]).
54+
* `diskstat(path=pwd())` can be used to return statistics about the disk ([#42248]).
5155
* `copyuntil(out, io, delim)` and `copyline(out, io)` copy data into an `out::IO` stream ([#48273]).
5256
* `eachrsplit(string, pattern)` iterates split substrings right to left.
57+
* `Sys.username()` can be used to return the current user's username ([#51897]).
5358

5459
New library features
5560
--------------------
5661
* `replace(string, pattern...)` now supports an optional `IO` argument to
5762
write the output to a stream rather than returning a string ([#48625]).
63+
* `sizehint!(s, n)` now supports an optional `shrink` argument to disable shrinking ([#51929]).
5864

5965
Standard library changes
6066
------------------------
6167

6268
#### StyledStrings
6369

64-
* A new standard library for handling styling in a more comprehensive and structured way.
70+
* A new standard library for handling styling in a more comprehensive and structured way ([#49586]).
6571
* The new `Faces` struct serves as a container for text styling information
6672
(think typeface, as well as color and decoration), and comes with a framework
6773
to provide a convenient, extensible (via `addface!`), and customisable (with a
6874
user's `Faces.toml` and `loadfaces!`) approach to
69-
styled content.
75+
styled content ([#49586]).
7076
* The new `@styled_str` string macro provides a convenient way of creating a
71-
`AnnotatedString` with various faces or other attributes applied.
77+
`AnnotatedString` with various faces or other attributes applied ([#49586]).
7278

7379
#### Package Manager
7480

@@ -88,7 +94,7 @@ Standard library changes
8894
#### REPL
8995

9096
* Tab complete hints now show in lighter text while typing in the repl. To disable
91-
set `Base.active_repl.options.hint_tab_completes = false` ([#51229])
97+
set `Base.active_repl.options.hint_tab_completes = false` ([#51229]).
9298
* Meta-M with an empty prompt now returns the contextual module of the REPL to `Main`.
9399

94100
#### SuiteSparse
@@ -102,7 +108,7 @@ Standard library changes
102108

103109
#### Statistics
104110

105-
* Statistics is now an upgradeable standard library.([#46501])
111+
* Statistics is now an upgradeable standard library ([#46501]).
106112

107113
#### Distributed
108114

@@ -122,13 +128,13 @@ Deprecated or removed
122128

123129
External dependencies
124130
---------------------
125-
* `tput` is no longer called to check terminal capabilities, it has been replaced with a pure-Julia terminfo parser.
131+
* `tput` is no longer called to check terminal capabilities, it has been replaced with a pure-Julia terminfo parser ([#50797]).
126132

127133
Tooling Improvements
128134
--------------------
129135

130136
* CI now performs limited automatic typo detection on all PRs. If you merge a PR with a
131137
failing typo CI check, then the reported typos will be automatically ignored in future CI
132-
runs on PRs that edit those same files. ([#51704])
138+
runs on PRs that edit those same files ([#51704]).
133139

134140
<!--- generated by NEWS-update.jl: -->

base/Base.jl

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ ccall(:jl_set_istopmod, Cvoid, (Any, Bool), Base, is_primary_base_module)
3434
macro inline() Expr(:meta, :inline) end
3535
macro noinline() Expr(:meta, :noinline) end
3636

37+
macro _boundscheck() Expr(:boundscheck) end
38+
3739
# Try to help prevent users from shooting them-selves in the foot
3840
# with ambiguities by defining a few common and critical operations
3941
# (and these don't need the extra convert code)
@@ -479,6 +481,7 @@ include("summarysize.jl")
479481
include("errorshow.jl")
480482

481483
include("initdefs.jl")
484+
Filesystem.__postinit__()
482485

483486
# worker threads
484487
include("threadcall.jl")
@@ -596,14 +599,12 @@ if is_primary_base_module
596599
# Profiling helper
597600
# triggers printing the report and (optionally) saving a heap snapshot after a SIGINFO/SIGUSR1 profile request
598601
# Needs to be in Base because Profile is no longer loaded on boot
599-
const PROFILE_PRINT_COND = Ref{Base.AsyncCondition}()
600-
function profile_printing_listener()
602+
function profile_printing_listener(cond::Base.AsyncCondition)
601603
profile = nothing
602604
try
603-
while true
604-
wait(PROFILE_PRINT_COND[])
605-
profile = @something(profile, require(PkgId(UUID("9abbd945-dff8-562f-b5e8-e1ebf5ef1b79"), "Profile")))
606-
605+
while _trywait(cond)
606+
# this call to require is mostly legal, only because Profile has no dependencies and is usually in LOAD_PATH
607+
profile = @something(profile, require(PkgId(UUID("9abbd945-dff8-562f-b5e8-e1ebf5ef1b79"), "Profile")))::Module
607608
invokelatest(profile.peek_report[])
608609
if Base.get_bool_env("JULIA_PROFILE_PEEK_HEAP_SNAPSHOT", false) === true
609610
println(stderr, "Saving heap snapshot...")
@@ -616,10 +617,13 @@ function profile_printing_listener()
616617
@error "Profile printing listener crashed" exception=ex,catch_backtrace()
617618
end
618619
end
620+
nothing
619621
end
620622

621623
function __init__()
622624
# Base library init
625+
global _atexit_hooks_finished = false
626+
Filesystem.__postinit__()
623627
reinit_stdio()
624628
Multimedia.reinit_displays() # since Multimedia.displays uses stdout as fallback
625629
# initialize loading
@@ -635,9 +639,20 @@ function __init__()
635639
# triggering a profile via signals is not implemented on windows
636640
cond = Base.AsyncCondition()
637641
Base.uv_unref(cond.handle)
638-
PROFILE_PRINT_COND[] = cond
639-
ccall(:jl_set_peek_cond, Cvoid, (Ptr{Cvoid},), PROFILE_PRINT_COND[].handle)
640-
errormonitor(Threads.@spawn(profile_printing_listener()))
642+
t = errormonitor(Threads.@spawn(profile_printing_listener(cond)))
643+
atexit() do
644+
# destroy this callback when exiting
645+
ccall(:jl_set_peek_cond, Cvoid, (Ptr{Cvoid},), C_NULL)
646+
# this will prompt any ongoing or pending event to flush also
647+
close(cond)
648+
# error-propagation is not needed, since the errormonitor will handle printing that better
649+
_wait(t)
650+
end
651+
finalizer(cond) do c
652+
# if something goes south, still make sure we aren't keeping a reference in C to this
653+
ccall(:jl_set_peek_cond, Cvoid, (Ptr{Cvoid},), C_NULL)
654+
end
655+
ccall(:jl_set_peek_cond, Cvoid, (Ptr{Cvoid},), cond.handle)
641656
end
642657
_require_world_age[] = get_world_counter()
643658
# Prevent spawned Julia process from getting stuck waiting on Tracy to connect.

base/abstractarray.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,6 +1034,8 @@ the other elements are left untouched.
10341034
10351035
See also [`copy!`](@ref Base.copy!), [`copy`](@ref).
10361036
1037+
$(_DOCS_ALIASING_WARNING)
1038+
10371039
# Examples
10381040
```jldoctest
10391041
julia> x = [1., 0., 3., 0., 5.];

base/abstractdict.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ struct KeyError <: Exception
1212
key
1313
end
1414

15+
KeyTypeError(K, key) = TypeError(:var"dict key", K, key)
16+
1517
const secret_table_token = :__c782dbf1cf4d6a2e5e3865d7e95634f2e09b5902__
1618

1719
haskey(d::AbstractDict, k) = in(k, keys(d))
@@ -218,8 +220,7 @@ Dict{Int64, Int64} with 3 entries:
218220
function merge!(d::AbstractDict, others::AbstractDict...)
219221
for other in others
220222
if haslength(d) && haslength(other)
221-
# TODO - do not shrink
222-
sizehint!(d, length(d) + length(other))
223+
sizehint!(d, length(d) + length(other); shrink = false)
223224
end
224225
for (k,v) in other
225226
d[k] = v

base/abstractset.jl

Lines changed: 103 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ max_values(::Type{Bool}) = 2
101101
max_values(::Type{Nothing}) = 1
102102

103103
function union!(s::AbstractSet{T}, itr) where T
104-
haslength(itr) && _sizehint!(s, length(s) + Int(length(itr))::Int; shrink = false)
104+
haslength(itr) && sizehint!(s, length(s) + Int(length(itr))::Int; shrink = false)
105105
for x in itr
106106
push!(s, x)
107107
length(s) == max_values(T) && break
@@ -364,6 +364,31 @@ hasfastin(x) = hasfastin(typeof(x))
364364

365365
(a, b) = b a
366366

367+
"""
368+
issubset(x)
369+
370+
Create a function that compares its argument to `x` using [`issubset`](@ref), i.e.
371+
a function equivalent to `y -> issubset(y, x)`.
372+
The returned function is of type `Base.Fix2{typeof(issubset)}`, which can be
373+
used to implement specialized methods.
374+
375+
!!! compat "Julia 1.11"
376+
This functionality requires at least Julia 1.11.
377+
"""
378+
issubset(a) = Fix2(issubset, a)
379+
380+
"""
381+
⊇(x)
382+
383+
Create a function that compares its argument to `x` using [`⊇`](@ref), i.e.
384+
a function equivalent to `y -> y ⊇ x`.
385+
The returned function is of type `Base.Fix2{typeof(⊇)}`, which can be
386+
used to implement specialized methods.
387+
388+
!!! compat "Julia 1.11"
389+
This functionality requires at least Julia 1.11.
390+
"""
391+
(a) = Fix2(, a)
367392
## strict subset comparison
368393

369394
function end
@@ -393,6 +418,31 @@ false
393418
(a, b) = Set(a) Set(b)
394419
(a, b) = b a
395420

421+
"""
422+
⊋(x)
423+
424+
Create a function that compares its argument to `x` using [`⊋`](@ref), i.e.
425+
a function equivalent to `y -> y ⊋ x`.
426+
The returned function is of type `Base.Fix2{typeof(⊋)}`, which can be
427+
used to implement specialized methods.
428+
429+
!!! compat "Julia 1.11"
430+
This functionality requires at least Julia 1.11.
431+
"""
432+
(a) = Fix2(, a)
433+
"""
434+
⊊(x)
435+
436+
Create a function that compares its argument to `x` using [`⊊`](@ref), i.e.
437+
a function equivalent to `y -> y ⊊ x`.
438+
The returned function is of type `Base.Fix2{typeof(⊊)}`, which can be
439+
used to implement specialized methods.
440+
441+
!!! compat "Julia 1.11"
442+
This functionality requires at least Julia 1.11.
443+
"""
444+
(a) = Fix2(, a)
445+
396446
function end
397447
function end
398448
"""
@@ -417,6 +467,32 @@ false
417467
(a, b) = !(a, b)
418468
(a, b) = b a
419469

470+
"""
471+
⊉(x)
472+
473+
Create a function that compares its argument to `x` using [`⊉`](@ref), i.e.
474+
a function equivalent to `y -> y ⊉ x`.
475+
The returned function is of type `Base.Fix2{typeof(⊉)}`, which can be
476+
used to implement specialized methods.
477+
478+
!!! compat "Julia 1.11"
479+
This functionality requires at least Julia 1.11.
480+
"""
481+
(a) = Fix2(, a)
482+
483+
"""
484+
⊈(x)
485+
486+
Create a function that compares its argument to `x` using [`⊈`](@ref), i.e.
487+
a function equivalent to `y -> y ⊈ x`.
488+
The returned function is of type `Base.Fix2{typeof(⊈)}`, which can be
489+
used to implement specialized methods.
490+
491+
!!! compat "Julia 1.11"
492+
This functionality requires at least Julia 1.11.
493+
"""
494+
(a) = Fix2(, a)
495+
420496
## set equality comparison
421497

422498
"""
@@ -453,6 +529,19 @@ function issetequal(a, b)
453529
return issetequal(Set(a), Set(b))
454530
end
455531

532+
"""
533+
issetequal(x)
534+
535+
Create a function that compares its argument to `x` using [`issetequal`](@ref), i.e.
536+
a function equivalent to `y -> issetequal(y, x)`.
537+
The returned function is of type `Base.Fix2{typeof(issetequal)}`, which can be
538+
used to implement specialized methods.
539+
540+
!!! compat "Julia 1.11"
541+
This functionality requires at least Julia 1.11.
542+
"""
543+
issetequal(a) = Fix2(issetequal, a)
544+
456545
## set disjoint comparison
457546
"""
458547
isdisjoint(a, b) -> Bool
@@ -499,6 +588,19 @@ function isdisjoint(a::AbstractRange{T}, b::AbstractRange{T}) where T
499588
end
500589
end
501590

591+
"""
592+
isdisjoint(x)
593+
594+
Create a function that compares its argument to `x` using [`isdisjoint`](@ref), i.e.
595+
a function equivalent to `y -> isdisjoint(y, x)`.
596+
The returned function is of type `Base.Fix2{typeof(isdisjoint)}`, which can be
597+
used to implement specialized methods.
598+
599+
!!! compat "Julia 1.11"
600+
This functionality requires at least Julia 1.11.
601+
"""
602+
isdisjoint(a) = Fix2(isdisjoint, a)
603+
502604
_overlapping_range_isdisjoint(a::AbstractRange{T}, b::AbstractRange{T}) where T = invoke(isdisjoint, Tuple{Any,Any}, a, b)
503605

504606
function _overlapping_range_isdisjoint(a::AbstractRange{T}, b::AbstractRange{T}) where T<:Integer

0 commit comments

Comments
 (0)