Skip to content

Commit 262daad

Browse files
authored
Backports for 1.10.6 (#55746)
Backported PRs: - [x] #51755 <!-- ASAN fixes. --> - [x] #55329 <!-- mapreduce: don't inbounds unknown functions --> - [x] #55365 <!-- ml-matches: ensure all methods are included --> - [x] #55483 <!-- fix hierarchy level of "API reference" in `Dates` documentation --> - [x] #55268 <!-- simplify complex atanh and remove singularity perturbation --> - [x] #55504 <!-- Update symmetric docstring to reflect the type of uplo --> - [x] #55524 <!-- Set `.jl` sources as read-only during installation --> - [x] #41244 <!-- Fix shell `cd` error when working dir has been deleted --> - [x] #55829 <!-- [Dates] Make test more robust against non-UTC timezones --> - [x] #55641 <!-- fall back to slower stat filesize if optimized filesize fails --> - [x] #55849 <!-- Mmap: fix grow! for non file IOs --> - [x] #55945 <!-- Fix logic in `?` docstring example --> - [x] #55743 <!-- doc: heap snapshot viewing --> - [x] #56023 <!-- Sockets: Warn when local network access not granted. --> - [x] #54276 <!-- Fix solve for complex `Hermitian` with non-vanishing imaginary part on diagonal --> - [x] #54669 <!-- Improve error message in inplace transpose --> - [x] #55295 <!-- LAPACK: Aggressive constprop to concretely infer syev!/syevd! --> - [x] #55303 <!-- avoid overflowing show for OffsetArrays around typemax --> - [x] #55342 <!-- Ensure bidiagonal setindex! does not read indices in error message --> - [x] #55507 <!-- Fix fast getptls ccall lowering. --> - [x] #55522 <!-- Fix tr for Symmetric/Hermitian block matrices --> - [x] #55854 <!-- 🤖 [master] Bump the Downloads stdlib from 1061ecc to 89d3c7d --> - [x] #55863 <!-- Update TaskLocalRNG docstring according to #49110 --> - [x] #55567 <!-- Initialize threadpools correctly during sysimg build --> - [x] #55506 <!-- Fix indexing in _mapreducedim for OffsetArrays --> - [x] #54737 <!-- LazyString in interpolated error messages involving types -->
2 parents 6f3fdf7 + ecf3a5d commit 262daad

Some content is hidden

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

70 files changed

+381
-174
lines changed

Makefile

+5
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,11 @@ endif
370370
cp -R -L $(JULIAHOME)/base/* $(DESTDIR)$(datarootdir)/julia/base
371371
cp -R -L $(JULIAHOME)/test/* $(DESTDIR)$(datarootdir)/julia/test
372372
cp -R -L $(build_datarootdir)/julia/* $(DESTDIR)$(datarootdir)/julia
373+
374+
# Set .jl sources as read-only to match package directories
375+
find $(DESTDIR)$(datarootdir)/julia/base -type f -name \*.jl -exec chmod 0444 '{}' \;
376+
find $(DESTDIR)$(datarootdir)/julia/test -type f -name \*.jl -exec chmod 0444 '{}' \;
377+
373378
# Copy documentation
374379
cp -R -L $(BUILDROOT)/doc/_build/html $(DESTDIR)$(docdir)/
375380
# Remove various files which should not be installed

base/Enums.jl

+11-10
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ end
9090
# give Enum types scalar behavior in broadcasting
9191
Base.broadcastable(x::Enum) = Ref(x)
9292

93-
@noinline enum_argument_error(typename, x) = throw(ArgumentError(string("invalid value for Enum $(typename): $x")))
93+
@noinline enum_argument_error(typename, x) = throw(ArgumentError(LazyString("invalid value for Enum ", typename, ": ", x)))
9494

9595
"""
9696
@enum EnumName[::BaseType] value1[=x] value2[=y]
@@ -143,18 +143,19 @@ julia> Symbol(apple)
143143
"""
144144
macro enum(T::Union{Symbol,Expr}, syms...)
145145
if isempty(syms)
146-
throw(ArgumentError("no arguments given for Enum $T"))
146+
throw(ArgumentError(LazyString("no arguments given for Enum ", T)))
147147
end
148148
basetype = Int32
149149
typename = T
150150
if isa(T, Expr) && T.head === :(::) && length(T.args) == 2 && isa(T.args[1], Symbol)
151151
typename = T.args[1]
152152
basetype = Core.eval(__module__, T.args[2])
153153
if !isa(basetype, DataType) || !(basetype <: Integer) || !isbitstype(basetype)
154-
throw(ArgumentError("invalid base type for Enum $typename, $T=::$basetype; base type must be an integer primitive type"))
154+
throw(ArgumentError(
155+
LazyString("invalid base type for Enum ", typename, ", ", T, "=::", basetype, "; base type must be an integer primitive type")))
155156
end
156157
elseif !isa(T, Symbol)
157-
throw(ArgumentError("invalid type expression for enum $T"))
158+
throw(ArgumentError(LazyString("invalid type expression for enum ", T)))
158159
end
159160
values = Vector{basetype}()
160161
seen = Set{Symbol}()
@@ -169,32 +170,32 @@ macro enum(T::Union{Symbol,Expr}, syms...)
169170
s isa LineNumberNode && continue
170171
if isa(s, Symbol)
171172
if i == typemin(basetype) && !isempty(values)
172-
throw(ArgumentError("overflow in value \"$s\" of Enum $typename"))
173+
throw(ArgumentError(LazyString("overflow in value \"", s, "\" of Enum ", typename)))
173174
end
174175
elseif isa(s, Expr) &&
175176
(s.head === :(=) || s.head === :kw) &&
176177
length(s.args) == 2 && isa(s.args[1], Symbol)
177178
i = Core.eval(__module__, s.args[2]) # allow exprs, e.g. uint128"1"
178179
if !isa(i, Integer)
179-
throw(ArgumentError("invalid value for Enum $typename, $s; values must be integers"))
180+
throw(ArgumentError(LazyString("invalid value for Enum ", typename, ", ", s, "; values must be integers")))
180181
end
181182
i = convert(basetype, i)
182183
s = s.args[1]
183184
hasexpr = true
184185
else
185-
throw(ArgumentError(string("invalid argument for Enum ", typename, ": ", s)))
186+
throw(ArgumentError(LazyString("invalid argument for Enum ", typename, ": ", s)))
186187
end
187188
s = s::Symbol
188189
if !Base.isidentifier(s)
189-
throw(ArgumentError("invalid name for Enum $typename; \"$s\" is not a valid identifier"))
190+
throw(ArgumentError(LazyString("invalid name for Enum ", typename, "; \"", s, "\" is not a valid identifier")))
190191
end
191192
if hasexpr && haskey(namemap, i)
192-
throw(ArgumentError("both $s and $(namemap[i]) have value $i in Enum $typename; values must be unique"))
193+
throw(ArgumentError(LazyString("both ", s, " and ", namemap[i], " have value ", i, " in Enum ", typename, "; values must be unique")))
193194
end
194195
namemap[i] = s
195196
push!(values, i)
196197
if s in seen
197-
throw(ArgumentError("name \"$s\" in Enum $typename is not unique"))
198+
throw(ArgumentError(LazyString("name \"", s, "\" in Enum ", typename, " is not unique")))
198199
end
199200
push!(seen, s)
200201
if length(values) == 1

base/abstractarray.jl

+9-8
Original file line numberDiff line numberDiff line change
@@ -756,8 +756,7 @@ julia> checkindex(Bool, 1:20, 21)
756756
false
757757
```
758758
"""
759-
checkindex(::Type{Bool}, inds::AbstractUnitRange, i) =
760-
throw(ArgumentError("unable to check bounds for indices of type $(typeof(i))"))
759+
checkindex(::Type{Bool}, inds::AbstractUnitRange, i) = throw(ArgumentError(LazyString("unable to check bounds for indices of type ", typeof(i))))
761760
checkindex(::Type{Bool}, inds::AbstractUnitRange, i::Real) = (first(inds) <= i) & (i <= last(inds))
762761
checkindex(::Type{Bool}, inds::IdentityUnitRange, i::Real) = checkindex(Bool, inds.indices, i)
763762
checkindex(::Type{Bool}, inds::OneTo{T}, i::T) where {T<:BitInteger} = unsigned(i - one(i)) < unsigned(last(inds))
@@ -1497,12 +1496,14 @@ much more common case where aliasing does not occur. By default,
14971496
unaliascopy(A::Array) = copy(A)
14981497
unaliascopy(A::AbstractArray)::typeof(A) = (@noinline; _unaliascopy(A, copy(A)))
14991498
_unaliascopy(A::T, C::T) where {T} = C
1500-
_unaliascopy(A, C) = throw(ArgumentError("""
1501-
an array of type `$(typename(typeof(A)).wrapper)` shares memory with another argument
1502-
and must make a preventative copy of itself in order to maintain consistent semantics,
1503-
but `copy(::$(typeof(A)))` returns a new array of type `$(typeof(C))`.
1504-
To fix, implement:
1505-
`Base.unaliascopy(A::$(typename(typeof(A)).wrapper))::typeof(A)`"""))
1499+
function _unaliascopy(A, C)
1500+
Aw = typename(typeof(A)).wrapper
1501+
throw(ArgumentError(LazyString("an array of type `", Aw, "` shares memory with another argument ",
1502+
"and must make a preventative copy of itself in order to maintain consistent semantics, ",
1503+
"but `copy(::", typeof(A), ")` returns a new array of type `", typeof(C), "`.\n",
1504+
"""To fix, implement:
1505+
`Base.unaliascopy(A::""", Aw, ")::typeof(A)`")))
1506+
end
15061507
unaliascopy(A) = A
15071508

15081509
"""

base/c.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ function ccall_macro_lower(convention, func, rettype, types, args, nreq)
650650
check = quote
651651
if !isa(func, Ptr{Cvoid})
652652
name = $name
653-
throw(ArgumentError("interpolated function `$name` was not a Ptr{Cvoid}, but $(typeof(func))"))
653+
throw(ArgumentError(LazyString("interpolated function `", name, "` was not a Ptr{Cvoid}, but ", typeof(func))))
654654
end
655655
end
656656
push!(statements, check)

base/client.jl

+9-4
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ function repl_cmd(cmd, out)
4040
if isempty(cmd.exec)
4141
throw(ArgumentError("no cmd to execute"))
4242
elseif cmd.exec[1] == "cd"
43-
new_oldpwd = pwd()
4443
if length(cmd.exec) > 2
4544
throw(ArgumentError("cd method only takes one argument"))
4645
elseif length(cmd.exec) == 2
@@ -51,11 +50,17 @@ function repl_cmd(cmd, out)
5150
end
5251
dir = ENV["OLDPWD"]
5352
end
54-
cd(dir)
5553
else
56-
cd()
54+
dir = homedir()
5755
end
58-
ENV["OLDPWD"] = new_oldpwd
56+
try
57+
ENV["OLDPWD"] = pwd()
58+
catch ex
59+
ex isa IOError || rethrow()
60+
# if current dir has been deleted, then pwd() will throw an IOError: pwd(): no such file or directory (ENOENT)
61+
delete!(ENV, "OLDPWD")
62+
end
63+
cd(dir)
5964
println(out, pwd())
6065
else
6166
@static if !Sys.iswindows()

base/compiler/tfuncs.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ function instanceof_tfunc(@nospecialize(t), @nospecialize(troot) = t)
134134
end
135135
return tr, isexact, isconcrete, istype
136136
elseif isa(t, Union)
137-
ta, isexact_a, isconcrete_a, istype_a = instanceof_tfunc(t.a, troot)
138-
tb, isexact_b, isconcrete_b, istype_b = instanceof_tfunc(t.b, troot)
137+
ta, isexact_a, isconcrete_a, istype_a = instanceof_tfunc(unwraptv(t.a), troot)
138+
tb, isexact_b, isconcrete_b, istype_b = instanceof_tfunc(unwraptv(t.b), troot)
139139
isconcrete = isconcrete_a && isconcrete_b
140140
istype = istype_a && istype_b
141141
# most users already handle the Union case, so here we assume that
@@ -536,9 +536,9 @@ add_tfunc(Core.sizeof, 1, 1, sizeof_tfunc, 1)
536536
end
537537
end
538538
if isa(x, Union)
539-
na = nfields_tfunc(𝕃, x.a)
539+
na = nfields_tfunc(𝕃, unwraptv(x.a))
540540
na === Int && return Int
541-
return tmerge(na, nfields_tfunc(𝕃, x.b))
541+
return tmerge(𝕃, na, nfields_tfunc(𝕃, unwraptv(x.b)))
542542
end
543543
return Int
544544
end

base/complex.jl

+7-10
Original file line numberDiff line numberDiff line change
@@ -1028,24 +1028,22 @@ end
10281028
function atanh(z::Complex{T}) where T
10291029
z = float(z)
10301030
Tf = float(T)
1031-
Ω = prevfloat(typemax(Tf))
1032-
θ = sqrt(Ω)/4
1033-
ρ = 1/θ
10341031
x, y = reim(z)
10351032
ax = abs(x)
10361033
ay = abs(y)
1034+
θ = sqrt(floatmax(Tf))/4
10371035
if ax > θ || ay > θ #Prevent overflow
10381036
if isnan(y)
10391037
if isinf(x)
10401038
return Complex(copysign(zero(x),x), y)
10411039
else
1042-
return Complex(real(1/z), y)
1040+
return Complex(real(inv(z)), y)
10431041
end
10441042
end
10451043
if isinf(y)
10461044
return Complex(copysign(zero(x),x), copysign(oftype(y,pi)/2, y))
10471045
end
1048-
return Complex(real(1/z), copysign(oftype(y,pi)/2, y))
1046+
return Complex(real(inv(z)), copysign(oftype(y,pi)/2, y))
10491047
end
10501048
β = copysign(one(Tf), x)
10511049
z *= β
@@ -1055,16 +1053,15 @@ function atanh(z::Complex{T}) where T
10551053
ξ = oftype(x, Inf)
10561054
η = y
10571055
else
1058-
ym = ay+ρ
1059-
ξ = log(sqrt(sqrt(4+y*y))/sqrt(ym))
1060-
η = copysign(oftype(y,pi)/2 + atan(ym/2), y)/2
1056+
ξ = log(sqrt(sqrt(muladd(y, y, 4)))/sqrt(ay))
1057+
η = copysign(oftype(y,pi)/2 + atan(ay/2), y)/2
10611058
end
10621059
else #Normal case
1063-
ysq = (ay+ρ)^2
1060+
ysq = ay^2
10641061
if x == 0
10651062
ξ = x
10661063
else
1067-
ξ = log1p(4x/((1-x)^2 + ysq))/4
1064+
ξ = log1p(4x/(muladd(1-x, 1-x, ysq)))/4
10681065
end
10691066
η = angle(Complex((1-x)*(1+x)-ysq, 2y))/2
10701067
end

base/docs/basedocs.jl

+6-3
Original file line numberDiff line numberDiff line change
@@ -916,11 +916,14 @@ expression, rather than the side effects that evaluating `b` or `c` may have.
916916
See the manual section on [control flow](@ref man-conditional-evaluation) for more details.
917917
918918
# Examples
919-
```
919+
```jldoctest
920920
julia> x = 1; y = 2;
921921
922-
julia> x > y ? println("x is larger") : println("y is larger")
923-
y is larger
922+
julia> x > y ? println("x is larger") : println("x is not larger")
923+
x is not larger
924+
925+
julia> x > y ? "x is larger" : x == y ? "x and y are equal" : "y is larger"
926+
"y is larger"
924927
```
925928
"""
926929
kw"?", kw"?:"

base/floatfuncs.jl

+3-1
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,9 @@ function isapprox(x::Integer, y::Integer;
316316
if norm === abs && atol < 1 && rtol == 0
317317
return x == y
318318
else
319-
return norm(x - y) <= max(atol, rtol*max(norm(x), norm(y)))
319+
# We need to take the difference `max` - `min` when comparing unsigned integers.
320+
_x, _y = x < y ? (x, y) : (y, x)
321+
return norm(_y - _x) <= max(atol, rtol*max(norm(_x), norm(_y)))
320322
end
321323
end
322324

base/indices.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,9 @@ to_index(I::AbstractArray{Bool}) = LogicalIndex(I)
295295
to_index(I::AbstractArray) = I
296296
to_index(I::AbstractArray{Union{}}) = I
297297
to_index(I::AbstractArray{<:Union{AbstractArray, Colon}}) =
298-
throw(ArgumentError("invalid index: $(limitrepr(I)) of type $(typeof(I))"))
298+
throw(ArgumentError(LazyString("invalid index: ", limitrepr(I), " of type ", typeof(I))))
299299
to_index(::Colon) = throw(ArgumentError("colons must be converted by to_indices(...)"))
300-
to_index(i) = throw(ArgumentError("invalid index: $(limitrepr(i)) of type $(typeof(i))"))
300+
to_index(i) = throw(ArgumentError(LazyString("invalid index: ", limitrepr(i), " of type ", typeof(i))))
301301

302302
# The general to_indices is mostly defined in multidimensional.jl, but this
303303
# definition is required for bootstrap:

base/intfuncs.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ julia> bitstring(2.2)
916916
```
917917
"""
918918
function bitstring(x::T) where {T}
919-
isprimitivetype(T) || throw(ArgumentError("$T not a primitive type"))
919+
isprimitivetype(T) || throw(ArgumentError(LazyString(T, " not a primitive type")))
920920
sz = sizeof(T) * 8
921921
str = StringVector(sz)
922922
i = sz
@@ -1016,7 +1016,7 @@ julia> digits!([2, 2, 2, 2, 2, 2], 10, base = 2)
10161016
function digits!(a::AbstractVector{T}, n::Integer; base::Integer = 10) where T<:Integer
10171017
2 <= abs(base) || throw(DomainError(base, "base must be ≥ 2 or ≤ -2"))
10181018
hastypemax(T) && abs(base) - 1 > typemax(T) &&
1019-
throw(ArgumentError("type $T too small for base $base"))
1019+
throw(ArgumentError(LazyString("type ", T, " too small for base ", base)))
10201020
isempty(a) && return a
10211021

10221022
if base > 0

base/io.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1263,7 +1263,7 @@ previously marked position. Throw an error if the stream is not marked.
12631263
See also [`mark`](@ref), [`unmark`](@ref), [`ismarked`](@ref).
12641264
"""
12651265
function reset(io::T) where T<:IO
1266-
ismarked(io) || throw(ArgumentError("$T not marked"))
1266+
ismarked(io) || throw(ArgumentError(LazyString(T, " not marked")))
12671267
m = io.mark
12681268
seek(io, m)
12691269
io.mark = -1 # must be after seek, or seek may fail

base/iostream.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,8 @@ end
222222
function filesize(s::IOStream)
223223
sz = @_lock_ios s ccall(:ios_filesize, Int64, (Ptr{Cvoid},), s.ios)
224224
if sz == -1
225-
err = Libc.errno()
226-
throw(IOError(string("filesize: ", Libc.strerror(err), " for ", s.name), err))
225+
# if `s` is not seekable `ios_filesize` can fail, so fall back to slower stat method
226+
sz = filesize(stat(s))
227227
end
228228
return sz
229229
end

base/iterators.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ using .Base:
1515
AbstractRange, AbstractUnitRange, UnitRange, LinearIndices, TupleOrBottom,
1616
(:), |, +, -, *, !==, !, ==, !=, <=, <, >, >=, missing,
1717
any, _counttuple, eachindex, ntuple, zero, prod, reduce, in, firstindex, lastindex,
18-
tail, fieldtypes, min, max, minimum, zero, oneunit, promote, promote_shape
18+
tail, fieldtypes, min, max, minimum, zero, oneunit, promote, promote_shape, LazyString
1919
using Core: @doc
2020

2121
if Base !== Core.Compiler
@@ -1048,15 +1048,15 @@ _prod_size(t::Tuple) = (_prod_size1(t[1], IteratorSize(t[1]))..., _prod_size(tai
10481048
_prod_size1(a, ::HasShape) = size(a)
10491049
_prod_size1(a, ::HasLength) = (length(a),)
10501050
_prod_size1(a, A) =
1051-
throw(ArgumentError("Cannot compute size for object of type $(typeof(a))"))
1051+
throw(ArgumentError(LazyString("Cannot compute size for object of type ", typeof(a))))
10521052

10531053
axes(P::ProductIterator) = _prod_indices(P.iterators)
10541054
_prod_indices(::Tuple{}) = ()
10551055
_prod_indices(t::Tuple) = (_prod_axes1(t[1], IteratorSize(t[1]))..., _prod_indices(tail(t))...)
10561056
_prod_axes1(a, ::HasShape) = axes(a)
10571057
_prod_axes1(a, ::HasLength) = (OneTo(length(a)),)
10581058
_prod_axes1(a, A) =
1059-
throw(ArgumentError("Cannot compute indices for object of type $(typeof(a))"))
1059+
throw(ArgumentError(LazyString("Cannot compute indices for object of type ", typeof(a))))
10601060

10611061
ndims(p::ProductIterator) = length(axes(p))
10621062
length(P::ProductIterator) = reduce(checked_mul, size(P); init=1)

base/loading.jl

+10-3
Original file line numberDiff line numberDiff line change
@@ -3115,9 +3115,16 @@ end
31153115

31163116
# now check if this file is fresh relative to its source files
31173117
if !skip_timecheck
3118-
if !samefile(includes[1].filename, modpath) && !samefile(fixup_stdlib_path(includes[1].filename), modpath)
3119-
@debug "Rejecting cache file $cachefile because it is for file $(includes[1].filename) not file $modpath"
3120-
return true # cache file was compiled from a different path
3118+
if !samefile(includes[1].filename, modpath)
3119+
stdlib_path = fixup_stdlib_path(includes[1].filename)
3120+
# In certain cases the path rewritten by `fixup_stdlib_path` may
3121+
# point to an unreadable directory, make sure we can `stat` the
3122+
# file before comparing it with `modpath`.
3123+
isreadable = iszero(@ccall jl_fs_access(stdlib_path::Cstring, 0x04::Cint)::Cint)
3124+
if !(isreadable && samefile(stdlib_path, modpath))
3125+
@debug "Rejecting cache file $cachefile because it is for file $(includes[1].filename) not file $modpath"
3126+
return true # cache file was compiled from a different path
3127+
end
31213128
end
31223129
for (modkey, req_modkey) in requires
31233130
# verify that `require(modkey, name(req_modkey))` ==> `req_modkey`

base/multidimensional.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ module IteratorsMD
583583
else
584584
# Given the fact that StepRange 1:2:4 === 1:2:3, we lost the original size information
585585
# and thus cannot calculate the correct linear indices when the steps are not 1.
586-
throw(ArgumentError("LinearIndices for $(typeof(inds)) with non-1 step size is not yet supported."))
586+
throw(ArgumentError(LazyString("LinearIndices for ", typeof(inds), " with non-1 step size is not yet supported.")))
587587
end
588588
end
589589

base/parse.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ function tryparse_internal(::Type{T}, s::AbstractString, raise::Bool; kwargs...)
385385
return result
386386
end
387387
@noinline _parse_failure(T, s::AbstractString, startpos = firstindex(s), endpos = lastindex(s)) =
388-
throw(ArgumentError("cannot parse $(repr(s[startpos:endpos])) as $T"))
388+
throw(ArgumentError(LazyString("cannot parse ", repr(s[startpos:endpos]), " as ", T)))
389389

390390
tryparse_internal(::Type{T}, s::AbstractString, startpos::Int, endpos::Int, raise::Bool) where T<:Integer =
391391
tryparse_internal(T, s, startpos, endpos, 10, raise)

base/rational.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ end
2929
checked_den(num::T, den::T) where T<:Integer = checked_den(T, num, den)
3030
checked_den(num::Integer, den::Integer) = checked_den(promote(num, den)...)
3131

32-
@noinline __throw_rational_argerror_zero(T) = throw(ArgumentError("invalid rational: zero($T)//zero($T)"))
32+
@noinline __throw_rational_argerror_zero(T) = throw(ArgumentError(LazyString("invalid rational: zero(", T, ")//zero(", T, ")")))
3333
function Rational{T}(num::Integer, den::Integer) where T<:Integer
3434
iszero(den) && iszero(num) && __throw_rational_argerror_zero(T)
3535
num, den = divgcd(num, den)

base/reduce.jl

+5-5
Original file line numberDiff line numberDiff line change
@@ -649,11 +649,11 @@ function mapreduce_impl(f, op::Union{typeof(max), typeof(min)},
649649
start = first + 1
650650
simdstop = start + chunk_len - 4
651651
while simdstop <= last - 3
652-
@inbounds for i in start:4:simdstop
653-
v1 = _fast(op, v1, f(A[i+0]))
654-
v2 = _fast(op, v2, f(A[i+1]))
655-
v3 = _fast(op, v3, f(A[i+2]))
656-
v4 = _fast(op, v4, f(A[i+3]))
652+
for i in start:4:simdstop
653+
v1 = _fast(op, v1, f(@inbounds(A[i+0])))
654+
v2 = _fast(op, v2, f(@inbounds(A[i+1])))
655+
v3 = _fast(op, v3, f(@inbounds(A[i+2])))
656+
v4 = _fast(op, v4, f(@inbounds(A[i+3])))
657657
end
658658
checkbounds(A, simdstop+3)
659659
start += chunk_len

0 commit comments

Comments
 (0)