Commit Graph

6693 Commits

Author SHA1 Message Date
Alex Martini
b3fc822a17 Clean up Hashable doc changes.
- Use present tense instead of future tense.
- Fix subject/object agreement.
- Fix indentation.

Follow-on to 58dd343dff (PR 58652).
2022-05-05 15:22:23 -07:00
swift-ci
032fe5b024 Merge remote-tracking branch 'origin/main' into rebranch 2022-05-04 14:29:49 -07:00
Karoy Lorentey
e285c41df9 [stdlib][docs] Slightly clarify Hashable docs 2022-05-03 16:29:52 -07:00
swift-ci
746f490f80 Merge remote-tracking branch 'origin/main' into rebranch 2022-05-02 07:14:58 -07:00
Erik Eckstein
a2c29858c3 stdlib: annotate the Array semantics functions with escape effects 2022-05-02 12:00:06 +02:00
swift-ci
fcfb12195a Merge remote-tracking branch 'origin/main' into rebranch 2022-04-29 14:35:21 -07:00
Karoy Lorentey
b8cbd4f226 [stdlib][docs] Clarify BidirectionalCollection requirements
As discussed on the forum, `BidirectionalCollection` requirements as
currently stated can be interpreted to forbid conforming types from
accepting indices that lie between valid (i.e., reachable) indices
in the collection. Among other undesirable effects, this
interpretation would render SE-0180 (String.Index overhaul)
incompatible with these requirements.

Update the wording to clarify that the requirements only apply to
valid indices. (Collection protocols do not constrain the behavior of
invalid indices — it’s up to individual collection types to implement
them as they wish.)

https://forums.swift.org/t/string-index-unification-vs-bidirectionalcollection-requirements/55946
rdar://92297280
2022-04-25 15:18:35 -07:00
swift_jenkins
3e55915bcb Merge remote-tracking branch 'origin/main' into next 2022-04-24 15:21:10 -07:00
Saleem Abdulrasool
5c0471fb48 stdlib: correct CLong for Windows ARM64
The Windows ARM64 build with the toolchain fixes exposed the missed type
aliasing for `CLong` when building Foundation.  With this it is finally
possible to build a complete SDK for Windows AArch64.
2022-04-24 10:33:36 -07:00
swift_jenkins
ee2fb0bc35 Merge remote-tracking branch 'origin/main' into next 2022-04-22 12:33:42 -07:00
swift-ci
c997944270 Merge pull request #42128 from amartini51/sendable_docs_87221356
Add reference page for Sendable protocol.
2022-04-22 12:05:59 -07:00
swift_jenkins
de7ecec04e Merge remote-tracking branch 'origin/main' into next 2022-04-21 19:22:23 -07:00
Jager-yoo
b3de1f3e25 Fix mismatched constant name in static func == doc
- I've found a mismatched constant name in `static func ==` example.
- Given the context, it should be `numberToMatch`, not `numberToFind`.
2022-04-21 19:11:17 +09:00
Alex Martini
59e951ae9c Fix minor wording issues per review feedback
Co-authored-by: Brian Lanier <blanier@apple.com>
2022-04-20 15:53:50 -07:00
swift_jenkins
a461eb25da Merge remote-tracking branch 'origin/main' into next 2022-04-19 21:21:22 -07:00
swift-ci
4184a0bb57 Merge pull request #42096 from kateinoigakukun/pr-24e8c53c23a06f91bc290068f3209e095a88bdcf
[Wasm][KeyPath] Resolve absolute function pointer as identity
2022-04-19 21:08:45 -07:00
swift_jenkins
da01d52532 Merge remote-tracking branch 'origin/main' into next 2022-04-19 20:41:22 -07:00
Karoy Lorentey
2574d78d40 Merge pull request #42442 from lorentey/better-index-conversions 2022-04-19 20:22:06 -07:00
swift_jenkins
093c99483d Merge remote-tracking branch 'origin/main' into next 2022-04-19 15:08:08 -07:00
Josh Soref
644c18ca9b Spelling stdlib (#42444)
* spelling: against

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: algorithmic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: alignment

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: anything

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: architectural

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: architecture

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: are

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: artificial

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: aside

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: available

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: being

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: bidirectional

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: characters

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: circular

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: compatibility

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: compiled

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: correctly

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: covers

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: declaration

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dependencies

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: descriptor

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dictionaries

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dynamic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: greater

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: hierarchy

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: immortal

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: initialize

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: initializes

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: iterable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: message

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: minimum

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: multiple

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: originally

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: simplified

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: sophisticated

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: trivia

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: wasn't

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-04-19 14:02:43 -07:00
Josh Soref
a0d2cabda6 Spelling stdlib/public/core (#42441)
* spelling: available

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: components

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: conjunction

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: conversion

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: enforce

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: guarantee

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: interchangeable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: satisfied

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: superfluous

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-04-19 14:02:24 -07:00
Karoy Lorentey
3eed5347c7 [stdlib] Update comments 2022-04-19 14:02:13 -07:00
Karoy Lorentey
47109ac8d6 [stdlib] Fix thinko 2022-04-19 13:08:43 -07:00
Karoy Lorentey
847337efd7 [stdlib][cosmetics] Clean up unused/underused interfaces, update naming
There is little point to having `isUTF16` properties when they simply
return `!isUTF8`; remove them.

Rename `String.Index._copyEncoding(from:)` to
`_copyingEncoding(from:)`.
2022-04-18 21:06:20 -07:00
Karoy Lorentey
5f9828fb88 [stdlib] Don’t reject trailing surrogates in UTF16View overload of String.Index(_:within:)
Fix a long-standing issue where the UTF16View overload of
`String.Index.init(_:within:)` used to return nil for valid indices
that happened to point to a trailing surrogate in a UTF-8-encoded
string.

rdar://91935537
2022-04-18 21:03:44 -07:00
Karoy Lorentey
4d557b0b45 [stdlib] Make String.Index(_:within:) initializers more permissive
In Swift 5.6 and below, (broken) code that acquired indices from a
UTF-16-encoded string bridged from Cocoa and kept using them after a
`makeContiguousUTF8` call (or other mutation) may have appeared to be
working correctly as long as the string was ASCII.

Since https://github.com/apple/swift/pull/41417, the
`String(_:within:)` initializers recognize miscoded indices and reject
them by returning nil. This is technically correct, but it
unfortunately may be a binary compatibility issue, as these used to
return non-nil in previous versions.

Mitigate this issue by accepting UTF-16 indices on a UTF-8 string,
transcoding their offset as needed. (Attempting to use an UTF-8 index
on a UTF-16 string is still rejected — we do not implicitly convert
strings in that direction.)

rdar://89369680
2022-04-18 21:02:14 -07:00
swift_jenkins
1652576a53 Merge remote-tracking branch 'origin/main' into next 2022-04-18 15:40:24 -07:00
swift-ci
58c8e2ecd8 Merge pull request #41033 from glessard/se-unaligned
[SE-0349] Implementation for unaligned loads from raw memory
2022-04-18 15:29:52 -07:00
Guillaume Lessard
a368e59564 [stdlib] incorporate proposal number in silgen name 2022-04-18 12:50:19 -06:00
Guillaume Lessard
3229902990 [stdlib] state clearly the precondition of loadUnaligned 2022-04-14 17:23:53 -06:00
Guillaume Lessard
1828aca9f0 [stdlib] update UnsafeMutableRawBufferPointer.storeBytes
- preserve previous version for ABI and source stability.
- add new version without alignment restriction.
- add explicit POD type enforcement in new version.
2022-04-14 17:23:53 -06:00
Guillaume Lessard
4b3e7fa41f [stdlib] add unaligned loads to Unsafe{Mutable}RawBufferPointer 2022-04-14 17:23:53 -06:00
Guillaume Lessard
9716bc5fd2 [stdlib] update UnsafeMutableRawPointer.storeBytes
- preserve previous version for ABI and source stability.
- add new version without alignment restriction.
- add explicit POD type enforcement in new version.
2022-04-14 17:23:53 -06:00
Guillaume Lessard
d9fff5b4ec [stdlib] add unaligned loads to UnsafeRawPointer 2022-04-14 17:23:53 -06:00
swift_jenkins
ceccb031ed Merge remote-tracking branch 'origin/main' into next 2022-04-14 14:21:33 -07:00
Karoy Lorentey
57f0e67658 Merge pull request #41417 from lorentey/the-horror-of-se-0180
[stdlib] Fix String indexing edge cases, anomalies & validation bugs
2022-04-14 14:08:53 -07:00
Karoy Lorentey
c67f08b2af [stdlib][NFC] Remove obsolete note 2022-04-13 19:15:42 -07:00
Karoy Lorentey
cb2194c024 [stdlib] Fix ABI and portability issues 2022-04-13 19:15:30 -07:00
Karoy Lorentey
89d69a9467 [stdlib] Revert noop change 2022-04-13 18:39:14 -07:00
Karoy Lorentey
b33fefb71c [stdlib] String: be more consistent about when markEncoding is called 2022-04-13 18:38:41 -07:00
swift_jenkins
7f6782fbc3 Merge remote-tracking branch 'origin/main' into next 2022-04-13 15:01:54 -07:00
Daniel Duan
3dfc40898c [NFC] Remove Python 2 imports from __future__ (#42086)
The `__future__` we relied on is now,  where the 3 specific things are
all included [since Python 3.0](https://docs.python.org/3/library/__future__.html):

* absolute_import
* print_function
* unicode_literals
* division

These import statements are no-ops and are no longer necessary.
2022-04-13 14:01:30 -07:00
swift_jenkins
4639b57530 Merge remote-tracking branch 'origin/main' into next 2022-04-13 12:19:40 -07:00
Alex Martini
06cbc7e4c4 Merge pull request #42318 from amartini51/UnsafeMutableRawBufferPointer_missing_parameter
Add missing parameter in `UnsafeMutableRawPointer`
2022-04-13 11:48:30 -07:00
swift_jenkins
06c023ff86 Merge remote-tracking branch 'origin/main' into next 2022-04-12 21:21:29 -07:00
Alex Martini
395a4b29be Add missing parameter.
Here, as in UnsafeMutableRawPointer.storeBytes(of:toByteOffset:as:)
"as" is an argument label and "type" is the parameter.

Because the function body doesn't use this -- it's just for type
information -- changing its name from "as" to "type" doesn't have
any impact there.
2022-04-11 16:50:01 -07:00
Alex Martini
2774f3dedc Call out unsafe-sendable structs & enums. 2022-04-11 16:37:26 -07:00
Alex Martini
c9bdda9cba Add discussion of metatypes.
Co-authored-by: Doug Gregor <dgregor@apple.com>
2022-04-11 16:31:16 -07:00
Alex Martini
c4b6f4bb8b Format bulleted lists the same throughout. 2022-04-11 16:30:23 -07:00
Alex Martini
32e0825068 Revise per tech review feedback.
Co-authored-by: Doug Gregor <dgregor@apple.com>
2022-04-11 16:23:39 -07:00