Commit Graph

3 Commits

Author SHA1 Message Date
Ben Langmuir
8ee2ce6f08 [test] Restrict test/stdlib/ArrayBuffer_CopyContents.swift to newer runtimes
This test is crashing on older runtimes, so disable it until someone can
investigate and decide what if anything should be done about it.
2021-09-24 11:49:12 -07:00
David Zarzycki
3178ff0310 [testing] Add missing REQUIRES: foundation 2021-06-17 06:40:37 -04:00
Karoy Lorentey
466e26a872 [stdlib] Implement _copyContents on internal Array types
`_copyContents(initializing:)` is a core method of Sequence, and it is used surprisingly often to copy stuff out of sequences. Array’s internal types currently have explicit implementations of it that trap (to prevent a performance bug due to the default iterator-based implementation. This has proved a bad idea, as not all code paths that end up calling `_copyContents` have actually been expunged — so we replaced a performance bug with a catastrophic correctness bug. 😥

Rather than trying to play whack-a-mole with code paths that end up in `_copyContents`, replace the traps with (relatively) efficient implementations, based on the ancient `_copyContents(subRange:initializing)` methods that have already been there all this time.

This resolves https://bugs.swift.org/browse/SR-14663.

I expect specialization will make this fix deploy back to earlier OSes in most (but unfortunately not all) cases.
2021-06-16 13:47:00 -07:00