From 0902f779a82c9c37d90f2c1a8b4854ae0833d7be Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Fri, 26 Jul 2024 12:41:09 +0200 Subject: [PATCH] Update base/array.jl Co-authored-by: Shuhei Kadowaki <40514306+aviatesk@users.noreply.github.com> --- base/array.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/base/array.jl b/base/array.jl index bfbf099cdd05dd..008a52abb952e1 100644 --- a/base/array.jl +++ b/base/array.jl @@ -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)