Skip to content

Commit

Permalink
Update base/array.jl
Browse files Browse the repository at this point in the history
Co-authored-by: Shuhei Kadowaki <[email protected]>
  • Loading branch information
KristofferC and aviatesk authored Jul 26, 2024
1 parent 26f0068 commit 0902f77
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3086,8 +3086,10 @@ function _wrap(ref::MemoryRef{T}, dims::NTuple{N, Int}) where {T, N}
return ref
end

@noinline invalid_wrap_err(len, dims, proddims) = throw(DimensionMismatch(
"Attempted to wrap a MemoryRef of length $len with an Array of size dims=$dims, which is invalid because prod(dims) = $proddims > $len, so that the array would have more elements than the underlying memory can store."))
@noinline invalid_wrap_err(len, dims, proddims) = throw(DimensionMismatch(LazyString(
"Attempted to wrap a MemoryRef of length ", len, " with an Array of size dims=", dims,
" which is invalid because prod(dims) = ", proddims, " > ", len,
" so that the array would have more elements than the underlying memory can store.")))

@eval @propagate_inbounds function wrap(::Type{Array}, m::MemoryRef{T}, dims::NTuple{N, Integer}) where {T, N}
dims = convert(Dims, dims)
Expand Down

0 comments on commit 0902f77

Please sign in to comment.