title: Casting between Swift array types without copy or allocations
body: <p>I want to access an existing array of UInt64 as if it is an array of Int8. Key requirement is efficiency - I don't want to copy or reallocate the data, just have direct access. I don't want side effects (for example I want to be able to continue to use the uint64Array after this block of code has executed, was reading about rebinding having undefined side effects.)</p>
  
  <p>I tried doing this with Swift 4.2:</p>
  
  <pre><code>var uint64Array = [UInt64](repeating: 0, count: 100)
  
  uint64Array.withUnsafeMutableBufferPointer() {
      uint64Pointer in
      uint64Pointer.withMemoryRebound(to: Int8.self) {   // &lt;- Error occurs here.
          int8Pointer in
          int8Pointer[0] = 1
          int8Pointer[1] = 2
          int8Pointer[2] = 3
          int8Pointer[3] = 4
      }
  }
  </code></pre>
  
  <p>However I get a Fatal Error at runtime on the following line:</p>
  
  <pre><code>    uint64Pointer.withMemoryRebound(to: Int8.self) {
  </code></pre>
  
  <p>Is this the right approach? If so, why am I getting the Fatal Error?</p>