Commit Graph

7182 Commits

Author SHA1 Message Date
swift-ci
6eee460618 Merge remote-tracking branch 'origin/main' into rebranch 2022-07-11 12:33:22 -07:00
Karoy Lorentey
5788a2cada Merge pull request #59959 from lorentey/duration-components-crash
[stdlib] Duration: Fix rare overflow trap in Int128.multipliedFullWidth
2022-07-11 12:30:44 -07:00
swift-ci
80161c6d49 Merge remote-tracking branch 'origin/main' into rebranch 2022-07-11 11:53:51 -07:00
David Smith
bcfa805635 Zero trailing bytes of SmallStrings more efficiently (#59823) 2022-07-11 11:46:15 -07:00
swift-ci
02d9592432 Merge remote-tracking branch 'origin/main' into rebranch 2022-07-08 22:53:31 -07:00
Karoy Lorentey
95a45dbc3d [stdlib] Duration: Fix rare overflow trap in Int128.multipliedFullWidth
Int128.multipliedFullWidth fails to account for an overflow case, which lead `Duration.components` trapping when the duration is a multiple of 512s.

rdar://96362510
2022-07-07 18:34:15 -07:00
Erik Eckstein
1fa0120926 stdlib: remove the inout-violation check from Array bounds checking
As we have exclusivity checking since a long time, this "explicit" check for inout violations is not needed anymore.
The `_checkInoutAndNativeTypeCheckedBounds` function must remain in the library for backward compatibility.
The remaining relevant subscript index checking from that function is now simply inlined in into the caller.
2022-07-07 16:53:55 +02:00
Alex Martini
8f6289745b Add per-architecture availability note.
The documentation publication pipeline doesn't have a way to expose
per-architecture availability, like how it it shows per-platform
availability.  So add this in prose instead.

Fixes <rdar://77649895>
2022-07-06 17:18:03 -07:00
Alex Martini
e46a285a98 Reference doesn't allow code voice in abstract.
Fixes <rdar://86212313>
2022-07-06 17:07:45 -07:00
swift-ci
3c548ea858 Merge remote-tracking branch 'origin/main' into rebranch 2022-07-06 14:15:10 -07:00
Karoy Lorentey
64a57e3ade [stdlib] Switch to using unchecked buffer subscript in low-level Unicode helpers
We expect indices to be already validated by the time these are
called, and UBP’s debug-mode checks are compiled into opaque parts
of the stdlib.

(The big exception is that Swift <5.7 used to not do proper index
validation and allowed out-of-bounds accesses. We emulate this
behavior for code that was compiled with such a release, and it turns
out that these UnsafeBufferPointer checks are interfering with the
intended (undefined) behavior.)

rdar://93707276
2022-07-05 18:33:51 -07:00
swift-ci
cfb7f4be53 Merge remote-tracking branch 'origin/main' into rebranch 2022-07-03 13:52:53 -07:00
Jager-yoo
eaff73b15c [stdlib] Fix func signature spacing
- standardizes spacing of an operator(==) func signature in Equatable.swift
2022-07-03 02:16:09 +09:00
Alex Martini
deed208b7b Add an example and cross reference to TSPL.
Fixes <rdar://79689446>
2022-06-30 12:34:47 -07:00
Alex Martini
93c350dff7 Reference style doesn't allow links in abstracts.
Fixes <rdar://93208475>
2022-06-30 12:34:40 -07:00
swift-ci
aeb93f5420 Merge remote-tracking branch 'origin/main' into rebranch 2022-06-29 22:53:27 -07:00
swift-ci
f542ca9a76 Merge pull request #59797 from glessard/aeic-mangled-names
[stdlib] Improve the mangled names of some @_alwaysEmitIntoClient functions
2022-06-29 22:46:23 -07:00
Guillaume Lessard
a74f22dadf [docs] fix a repeated typo 2022-06-29 18:19:34 -06:00
Guillaume Lessard
e353e2f568 [stdlib] document compatibility entry point silgen names better 2022-06-29 16:21:55 -06:00
Guillaume Lessard
6d36a36dd9 [stdlib] improve silgen names and better document intention 2022-06-29 16:20:34 -06:00
swift-ci
2183c1d21a Merge remote-tracking branch 'origin/main' into rebranch 2022-06-29 15:13:35 -07:00
Steven Wu
ea31a9222f stdlib: Fix the name mangling for UnsafeMutableRawPointer.storeBytes
The name mangling for storeBytes is missing `$`.

rdar://96062712
2022-06-29 09:52:51 -07:00
swift-ci
306440cd76 Merge remote-tracking branch 'origin/main' into rebranch 2022-06-24 10:53:37 -07:00
Karoy Lorentey
789545d1be Merge pull request #41843 from lorentey/adopt-primary-associated-types
[SE-0358][stdlib] Adopt primary associated types
2022-06-24 10:46:29 -07:00
swift-ci
89d5dc978f Merge remote-tracking branch 'origin/main' into rebranch 2022-06-23 14:14:59 -07:00
Slava Pestov
2734f3ca05 stdlib: Add SIMDMaskScalar.SIMDMaskScalar == SIMDMaskScalar requirement to SIMDScalar
In theory this is a source break if someone had a weird custom
conforming type, but I suspect in practice conformances to
this protocol are never defined.

The reason we want this requirement is that often you will see
code like the following:

  protocol Point {
    associatedtype Scalar: SIMDScalar
    associatedtype Vector: SIMD where Vector.Scalar == Scalar
  }

  extension Point where Vector == SIMD2<Scalar> { ... }

When `Vector` is equated with `SIMD2<Scalar>`, we get an infinite
sequence of implied same-type requirements:

  Vector.MaskStorage == SIMD2<Scalar.MaskScalar>
  Vector.MaskStorage.MaskStorage == SIMD2<Scalar.MaskScalar.MaskScalar>
  ...

The protocol fails to typecheck with an error because the requirement
machine cannot build a rewrite system.

If SIMDScalar requires that MaskScalar.MaskScalar == MaskScalar, then
we instead get

  Vector.MaskStorage == SIMD2<Scalar.MaskScalar>
  Vector.MaskStorage.MaskStorage == SIMD2<Scalar.MaskScalar>

  Vector.MaskStorage.MaskStorage == Vector.MaskStorage
  ...

Which ties off the recursion.

In theory, a more advanced implementation could represent this kind of
infinite recursion in 'closed form', but we don't have that yet, and I
believe adding this same-type requirement makes sense anyway.

Fixes rdar://problem/95075552.
2022-06-22 21:26:15 -04:00
Karoy Lorentey
2759a710e6 [stdlib] OptionSet: Remove the primary associated type declaration
`Element` is expected to always be `Self`. `RawValue` would be a better choice for the primary type ("option set of UInt32"), but to avoid confusion, it seems better to just omit the declaration, at least for now.
2022-06-22 17:22:18 -07:00
swift-ci
b8f39b56be Merge remote-tracking branch 'origin/main' into rebranch 2022-06-22 09:15:09 -07:00
Alejandro Alonso
95da55b182 [stdlib] Implement String.WordView (#42414)
* Implement String.WordView

* Add isWordAligned bit

* Hide WordView for now (also separate Index type)

add bidirectional conformance

Fix tests

* Address comments from Karoy and Michael

* Remove word view, use index methods

* Address Karoy's comments

aaa
2022-06-22 09:10:09 -07:00
swift-ci
c6d6dc5bc0 Merge remote-tracking branch 'origin/main' into rebranch 2022-06-22 07:54:04 -07:00
Guillaume Lessard
69392a772a Merge pull request #59327 from glessard/rdar46444561-optional-equality-operator
[stdlib] use @_transparent in an appropriate spot
2022-06-22 08:39:42 -06:00
swift-ci
8bc1fbdada Merge remote-tracking branch 'origin/main' into rebranch 2022-06-21 21:53:58 -07:00
Mishal Shah
475ed80c3e Update the SwiftStdlib 5.7 availability 2022-06-21 15:23:10 -07:00
swift-ci
ed378ecae8 Merge remote-tracking branch 'origin/main' into rebranch 2022-06-13 19:54:01 -07:00
Karoy Lorentey
01d7b5799c [stdlib] Fix handling of duplicate items in generic Set.intersection
If the sequence passed to `Set.intersection` has exactly as many duplicate items as items missing from `self`, then the new implementation in 5.6 will mistakenly return `self` unchanged. (It counts duplicate hits as distinct items in the result.)

rdar://94803458
2022-06-13 14:12:48 -07:00
swift-ci
d6fceb79c5 Merge remote-tracking branch 'origin/main' into rebranch 2022-06-13 11:53:47 -07:00
Karoy Lorentey
2da382dc6b Merge pull request #59243 from rctcwyvrn/lily-dictionary-optimization
Optimize Dictionary.filter for native dictionaries
2022-06-13 11:47:12 -07:00
swift-ci
88de6f4757 Merge remote-tracking branch 'origin/main' into rebranch 2022-06-10 13:13:37 -07:00
swift-ci
e78643c08a Merge pull request #59143 from fulldecent/patch-1
Correct complexity statement for Sequence compactMap
2022-06-10 13:03:04 -07:00
swift-ci
8c515e418a Merge remote-tracking branch 'origin/main' into rebranch 2022-06-10 12:32:53 -07:00
Guillaume Lessard
4dffe2716f Merge pull request #59330 from glessard/rdar94296845-assertionFailure-docs
[docs] improvements for assertionFailure and preconditionFailure
2022-06-10 13:15:16 -06:00
swift-ci
8a59b92e7d Merge remote-tracking branch 'origin/main' into rebranch 2022-06-10 11:13:11 -07:00
Karoy Lorentey
6d2d2e0005 Merge pull request #38091 from glessard/indexing-model
[stdlib] fix an indexing inconsistency
2022-06-10 11:02:13 -07:00
Karoy Lorentey
35fc9ea772 Merge pull request #59117 from glessard/se0349-doctweak
[doc] mention `loadUnaligned` in the description of `UnsafeRawBufferPointer`
2022-06-10 11:00:59 -07:00
swift-ci
3597ca75f0 Merge remote-tracking branch 'origin/main' into rebranch 2022-06-09 02:52:39 -07:00
Guillaume Lessard
7a157f99ab [stdlib] use @_transparent in an appropriate spot 2022-06-08 13:49:18 -06:00
Guillaume Lessard
6219ae998d [docs] improvements for assertionFailure and preconditionFailure
- the previous docs for assertionFailure implies that it is a nonreturning function, which has always been wrong.
- the example usage previously given for assertionFailure was moved to preconditionFailure, where it is more appropriate.
2022-06-08 13:43:19 -06:00
Alastair Houghton
33f103f03e [Build] Fix some issues with the standalone library build.
When we're building static libraries, we don't need to include the
threading objects in both Concurrency and Core, and we also don't need
two copies of the threading library's fatal error handler.

rdar://90776105
2022-06-07 07:39:53 +01:00
Alastair Houghton
05cccf939b [Runtime][Windows] Need to link with Synchronization.lib.
We're using some functions from Synchronization.lib now, after the
threading changes.

rdar://90776105
2022-06-07 07:39:52 +01:00
Alastair Houghton
f5bdb858e0 [Threading] Create new threading library and use it.
Moved all the threading code to one place.  Added explicit support for
Darwin, Linux, Pthreads, C11 threads and Win32 threads, including new
implementations of Once for Linux, Pthreads, C11 and Win32.

rdar://90776105
2022-06-07 07:39:51 +01:00