<div dir="ltr">Great! Yes, changing the diagnostic message will save people from having to ask this question.<div><br></div><div>Thanks, Ed</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 19, 2017 at 10:30 AM, Devin Coughlin <span dir="ltr">&lt;<a href="mailto:dcoughlin@apple.com" target="_blank">dcoughlin@apple.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi Ed,<div><span class=""><br><div><div><div><blockquote type="cite"><div>On May 19, 2017, at 10:10 AM, Edward Connell via swift-users &lt;<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a>&gt; wrote:</div><br class="m_-2327866130583878464Apple-interchange-newline"><div><div dir="ltr">I just switched to the 5/17 swift 4.0 tool chain on Linux, and I am getting the following complaint when using swap on array elements. Is this warning legitimate because of a copy on write issue? If so, is there some new swap function for array elements? I realize I can turn 1 line into 3 and do the swapping myself, it&#39;s just verbose.<div><br></div><div><div><i>warning: simultaneous accesses to var &#39;dims&#39;, but modification requires exclusive access; consider copying to a local variable</i></div><div><i>                                swap(&amp;dims[lastIndex], &amp;dims[lastIndex-1])</i></div></div></div></div></blockquote></div><br></div></div></span><div>You can use the new swapAt() method:</div><div><br></div><div>   dims.swapAt(lastIndex, lastIndex-1)</div><div><br></div><div>I recently added a Fix-It for this — but we really should also say &quot;consider using ‘swapAt()’” in the diagnostic text as well in this case rather then mentioning copying to a local.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Devin</div><div><br></div><div><br></div></font></span></div></div></blockquote></div><br></div>