Previously, we didn't mark an array's element type's destructor referenced when it was annotated with no_destroy. This is not correct: we still need the destructor if we need to do any cleanup if an element's constructor throws. This was leading to crashes and linker errors. The fix is just to mark the destructor referenced in the array case.
This leads to an inconsistency with access control: If the array element type's destructor is used, then we really ought check its access. However, that would be a source breaking change. This patch ignores access checking, which is a bit unfortunate, but I think its the best we can do if we're not willing to break source compatibility.
Fixes rdar://48462498
Thanks!
Erik