Skip to content

Commit 0f3ed2b

Browse files
author
Andy Ferris
committed
Remove setindex! on mutable non-isbits containers
Closes #27
1 parent e72b219 commit 0f3ed2b

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

src/MArray.jl

+4-2
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,10 @@ end
9494

9595
if isbits(T)
9696
unsafe_store!(Base.unsafe_convert(Ptr{T}, Base.data_pointer_from_objref(v)), val, i)
97-
else # TODO check that this isn't crazy. Also, check it doesn't cause problems with GC...
98-
unsafe_store!(Base.unsafe_convert(Ptr{Ptr{Void}}, Base.data_pointer_from_objref(v.data)), Base.data_pointer_from_objref(val), i)
97+
else
98+
# This one is thought to be unsafe (#27)
99+
# unsafe_store!(Base.unsafe_convert(Ptr{Ptr{Void}}, Base.data_pointer_from_objref(v.data)), Base.data_pointer_from_objref(val), i)
100+
error("setindex!() with non-isbits eltype is not supported by StaticArrays")
99101
end
100102

101103
return val

src/MMatrix.jl

+3-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ end
113113
if isbits(T)
114114
unsafe_store!(Base.unsafe_convert(Ptr{T}, Base.data_pointer_from_objref(m)), val, i)
115115
else # TODO check that this isn't crazy. Also, check it doesn't cause problems with GC...
116-
unsafe_store!(Base.unsafe_convert(Ptr{Ptr{Void}}, Base.data_pointer_from_objref(m.data)), Base.data_pointer_from_objref(val), i)
116+
# This one is thought to be unsafe (#27)
117+
# unsafe_store!(Base.unsafe_convert(Ptr{Ptr{Void}}, Base.data_pointer_from_objref(m.data)), Base.data_pointer_from_objref(val), i)
118+
error("setindex!() with non-isbits eltype is not supported by StaticArrays")
117119
end
118120

119121
return val

src/MVector.jl

+4-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ end
4646

4747
if isbits(T)
4848
unsafe_store!(Base.unsafe_convert(Ptr{T}, Base.data_pointer_from_objref(v)), val, i)
49-
else # TODO check that this isn't crazy. Also, check it doesn't cause problems with GC...
50-
unsafe_store!(Base.unsafe_convert(Ptr{Ptr{Void}}, Base.data_pointer_from_objref(v.data)), Base.data_pointer_from_objref(val), i)
49+
else
50+
# This one is thought to be unsafe (#27)
51+
#unsafe_store!(Base.unsafe_convert(Ptr{Ptr{Void}}, Base.data_pointer_from_objref(v.data)), Base.data_pointer_from_objref(val), i)
52+
error("setindex!() with non-isbits eltype is not supported by StaticArrays")
5153
end
5254

5355
return val

0 commit comments

Comments
 (0)