Commit Graph

3392 Commits

Author SHA1 Message Date
Jonathan Grynspan
83d82a5af5 swift_slowAlloc() assumes malloc(0) returns non-NULL. (#86922)
`swift_slowAlloc()` and related functions assume that `malloc(0)` and `aligned_alloc(0)` return non-`NULL` pointers. The C standards allow implementations to return `NULL` when the allocation size is `0`.

This PR implements a check for `0` that instead allocates `1`. The cost of the check is negligible next to the cost of actually allocating, but we'll mark it `SWIFT_UNLIKELY` just in case.

Resolves rdar://169304909.
2026-02-05 21:44:47 -08:00
Henrik G. Olsson
52557857a2 Merge pull request #86520 from ramonasuncion/fix-mirror-if-sub-lit
[Test][stdlib] Migrate Mirror test from shell if to lit %if
2026-01-30 12:48:31 -08:00
Ramon Asuncion
5407531793 [Test][stdlib] Remove REQUIRES shell directive from MirrorWithPacks 2026-01-29 21:57:26 -05:00
Ramon Asuncion
e44362c7c2 [Test][stdlib] Minimize diff for lit %if migration in Mirror tests 2026-01-29 13:27:41 -05:00
Ramon Asuncion
08e63326ec [Test][stdlib] Use objc_interop instead of OS_FAMILY=darwin in Mirror tests 2026-01-29 13:05:02 -05:00
Guillaume Lessard
881d5078ba [test] fix [Mutable]Span.withUnsafe[Mutable]BufferPointer 2026-01-28 15:51:06 -08:00
Guillaume Lessard
5682ba3d28 [test] OutputSpan.wUMBP 2026-01-28 14:47:36 -08:00
eeckstein
be5e89a9bb Merge pull request #86702 from eeckstein/mandatory-inliner
Optimizer: fix a few problems where destroys are illegally hoisted across deinit barriers
2026-01-23 20:35:31 +01:00
Guillaume Lessard
8f1f7ddbec Merge pull request #86718 from glessard/rdar168561707-outputrawspan-storeBytes-safety
[stdlib] mark `OutputRawSpan.storeBytes()` with `@unsafe`
2026-01-23 11:14:22 -08:00
Guillaume Lessard
f2a3a1ae9d Merge pull request #86726 from glessard/rdar166692988-another-utf8span-testfix
[test] adjust test for watchOS compatibility
2026-01-23 11:13:51 -08:00
Erik Eckstein
172bf39901 Optimizer: let OSSA canonicalization always respect deinit barriers
When computing the region to search for deinit barriers, include _all_ destroys of a canonical liverange - including destroys of all copies.
Before this fix, only destroys of the original def were considered which resulted in moving destroys across deinit barriers.

Fixes a miscompile
rdar://168337959
2026-01-23 10:08:41 +01:00
Guillaume Lessard
c403bc97d3 [test] adjust test for watchOS compatibility 2026-01-22 15:00:12 -08:00
Guillaume Lessard
c0d164bc2e [test] modify test for strict memory safety 2026-01-21 17:43:29 -08:00
Guillaume Lessard
56f11c1dbd Merge pull request #86571 from glessard/rdar155660454-array-plus-outputspan-followups
[stdlib] followup to #83657
2026-01-20 15:50:31 -08:00
Tim Kientzle
6d833676b6 Merge pull request #86490 from tbkka/tbkka-overeager-hexfloat-underflow
FP Parsing: Fix over-eager underflow check
2026-01-15 19:54:00 -08:00
Guillaume Lessard
482cebc9a5 [test] explicitly test invalid negative parameter values 2026-01-14 16:53:37 -08:00
Guillaume Lessard
e334d9c1de Merge pull request #83657 from glessard/rdar155660454-array-plus-outputspan
[stdlib, SE-0485] Array functions with OutputSpan
2026-01-14 14:30:05 -08:00
Guillaume Lessard
58b0e565f0 [stdlib] preserve items appended until a thrown error 2026-01-13 15:00:49 -08:00
Ramon Asuncion
c52265068c [Test][stdlib] Use OS_FAMILY=darwin instead of OS=darwin 2026-01-13 10:33:53 -05:00
Ramon Asuncion
b6826bbdb9 [Test][stdlib] Migrate Mirror test from shell if to lit %if 2026-01-13 10:15:37 -05:00
Tim Kientzle
bd67f95305 FP Parsing: Fix over-eager underflow check
An early check for underflow was a bit too aggressive, resulting in values that
would otherwise round up to the smallest subnormal failing to go through the
regular rounding logic.

Resolves #86462
Resolves rdar://167942063
2026-01-12 11:52:31 -08:00
Guillaume Lessard
be9708a547 Merge pull request #86435 from glessard/rdar165001871-span-withUBP-empty
[stdlib] simplify span-family `withUnsafe...` implementations
2026-01-10 11:22:26 -08:00
Guillaume Lessard
ad8dec0e16 [test] update test expectations 2026-01-09 18:21:18 -08:00
Tim Kientzle
e38d5ff0c3 Merge pull request #86263 from tbkka/tbkka-float-parsing-old-os
Disable these tests on older macOS versions
2026-01-03 14:06:22 -08:00
Alejandro Alonso
8909023c90 Merge pull request #86067 from Azoy/unicode-17
[stdlib] Update to Unicode 17
2026-01-03 16:54:02 -05:00
Tim Kientzle
3495493627 Disable these tests on older macOS versions
These tests exercise known bugs in older Swift versions,
and as such are expected to fail when run on old versions of
macOS with bundled Swift stdlib.

Resolves: rdar://166985147
2026-01-02 10:06:11 -08:00
Guillaume Lessard
6b0c233042 [stdlib] simplifications 2025-12-27 19:05:15 -08:00
Guillaume Lessard
aed35825f9 [test] OutputSpan-mediated init() and append() functions 2025-12-27 19:05:15 -08:00
Tim Kientzle
5c2f51e0f6 Merge pull request #86018 from tbkka/tbkka-float-parsing-substring
New FP Parsing:  Use relevant part of a substring
2025-12-20 04:38:13 -08:00
Pavel Yaskevich
fdcff3a962 Merge pull request #86134 from xedin/rdar-157249275
[CSDiagnostics] Produce a tailored diagnostic for key path mutability mismatches
2025-12-19 22:17:19 -08:00
Pavel Yaskevich
b1ccdc30c4 [CSSimplify] Match root/value of a key path even when superclass check fails
This helps to propagate types bi-directionally and avoid extraneous
failures related to generic parameter inference when the real issue
is mutability or type erasure.
2025-12-18 16:39:16 -08:00
Tim Kientzle
889dd290f8 Break out bridging to a separate test source file 2025-12-17 17:15:34 -08:00
Tim Kientzle
13529d01b2 Comment out Bridged tests that cannot run on Linux 2025-12-17 17:12:34 -08:00
Tim Kientzle
5d3e17ae5f Test short and long bridged strings
Simplify the top-level initializer by using `Substring.withUTF8`
to get a correct span over contiguous UTF8.
2025-12-17 16:50:02 -08:00
Tim Kientzle
46311986f7 Use the correct portion of a substring 2025-12-17 16:50:02 -08:00
Karoy Lorentey
05d4565146 Merge pull request #82438 from vanvoorden/array-identical
[SE-0494][StdLib] Add `isTriviallyIdentical(to:)` Methods to Array, ArraySlice, and ContiguousArray
2025-12-17 13:54:30 -08:00
Ben Cohen
5ac2d2497a Allow Comparable: ~Escapable (#85891)
Builds on #85854
2025-12-16 10:17:58 -08:00
Alejandro Alonso
39906adfe2 Update Unicode data to 17 for generators
more updates

more
2025-12-15 12:21:03 -08:00
Tim Kientzle
e75a8c03e7 Fix parsing issues on 32-bit hosts
These were mostly bugs with code of the following form:
```
  if uint64Value < (... literal expression ...)
```
Swift's comparison operators allow their left- and right-hand sides to be of
different widths.  This in turn means that the literal expression above
typically gets typechecked by default as a plain `Int` or `UInt` expression.
In a number of cases, this led to truncation on platforms where `Int` is
not 64 bits.

In particular, this seems to fix tests on wasm32.
2025-12-12 07:16:59 -08:00
Karoy Lorentey
a233485029 Merge pull request #82055 from vanvoorden/string-identical
[SE-0494][StdLib] Add `isTriviallyIdentical(to:)` Methods to String and Substring
2025-12-11 15:55:11 -08:00
Ben Cohen
9dd9e96e1d Allow Hashable: ~Copyable (#85748)
Builds on #85746 which covers Equatable.
2025-12-11 14:47:36 -08:00
Guillaume Lessard
e293876e4f Merge pull request #85597 from glessard/substring-test-tweaks 2025-12-10 14:09:13 -08:00
Tim Kientzle
efdd00892c Merge pull request #85797 from tbkka/tbkka-float-parsing
Reimplement Floating-Point Parsing in pure Swift
2025-12-10 18:42:41 +00:00
Tim Kientzle
313c4a6e77 Do not bother trying to run this test on watchOS 2025-12-10 09:06:53 +00:00
Tim Kientzle
3670162137 Disable unsupported configuration 2025-12-09 15:42:14 +00:00
Tim Kientzle
a6e3f5535c Disable some unsupported test combinations 2025-12-09 09:31:24 +00:00
Ben Rimmington
b27c90b8b8 [SE-0494] isTriviallyIdentical(to:) [memory regions] (#84998)
Add `isTriviallyIdentical(to:)` methods to:

* `Span`
* `RawSpan`
* `UTF8Span`
* `UnsafeBufferPointer`
* `UnsafeMutableBufferPointer`
* `UnsafeRawBufferPointer`
* `UnsafeMutableRawBufferPointer`

Part of issue swiftlang/swift#84991.
2025-12-08 19:32:26 -08:00
Rick van Voorden
048091d6f2 [stdlib] array identical
Co-Authored-By: Ben Rimmington <me@benrimmington.com>
2025-12-08 17:39:01 -08:00
Karoy Lorentey
4cde919950 [stdlib] Update availability of String view additions 2025-12-08 17:32:20 -08:00
WindowsMEMZ
8055d91316 Update tests for availability checking 2025-12-08 17:32:19 -08:00