Commit Graph

42 Commits

Author SHA1 Message Date
Karoy Lorentey
86f6c29e34 [stdlib] Temporarily reinstate original ObjectIdentifier.init as public
The new generalization sometimes causes a runtime hang that I’m still analyzing. The original declaration should be considered more specific for preexisting use cases, eliminating the source compatibility issue.
2025-03-27 11:24:31 -07:00
Karoy Lorentey
eba00922c3 [stdlib] Properly generalize ObjectIdentifier.init(Any.Type)
With Slava’s fix in https://github.com/swiftlang/swift/pull/79647, we can now refer to generalized type existentials in ABI stable code.
2025-03-24 12:16:07 -07:00
Karoy Lorentey
463f35531c [stdlib] ObjectIdentifier: Work around issue with generalized existentials 2025-03-24 12:15:49 -07:00
Karoy Lorentey
0d926834c8 [stdlib] ObjectIdentifier: Also allow nonescapable types 2025-03-24 12:15:44 -07:00
Karoy Lorentey
a0751a4a89 [stdlib] ObjectIdentifier: Allow initialization from metatypes of noncopyable types 2025-03-24 12:15:43 -07:00
Doug Gregor
22eecacc35 Adopt unsafe annotations throughout the standard library 2025-02-26 14:28:01 -08:00
Alex Martini
d0d15167d3 Add missing "parameters" directive
Co-authored-by: Ben Rimmington <me@benrimmington.com>
2024-08-07 11:07:54 -07:00
Alex Martini
63323e04a9 Match parameter names in docs to the declaration 2024-08-01 11:01:02 -07:00
Kuba Mracek
043a9fd15c [embedded] Move embedded ifdefs around in ObjectIdentifier.swift to avoid detaching doccomments from their decls 2023-10-14 11:27:14 -07:00
Philippe Hausler
029e296b34 Allow Identifiable and correct ObjectIdentifier for embedded variants (#68597) 2023-09-19 13:25:32 -07:00
Kuba Mracek
92b075b518 [embedded] Drop several #ifs and fatalError()s by adding an unavailable ExpressibleByStringInterpolation String conformance 2023-09-16 13:40:25 -07:00
Kuba Mracek
ae2e903574 [embedded] Build an initial embedded Swift standard library
This isn't a "complete" port of the standard library for embedded Swift, but
something that should serve as a starting point for further iterations on the
stdlib.

- General CMake logic for building a library as ".swiftmodule only" (ONLY_SWIFTMODULE).
- CMake logic in stdlib/public/core/CMakeLists.txt to start building the embedded stdlib for a handful of hardcoded target triples.
- Lots of annotations throughout the standard library to make types, functions, protocols unavailable in embedded Swift (@_unavailableInEmbedded).
- Mainly this is about stdlib functionality that relies on existentials, type erasure, metatypes, reflection, string interpolations.
- We rely on function body removal of unavailable functions to eliminate the actual problematic SIL code (existentials).
- Many .swift files are not included in the compilation of embedded stdlib at all, to simplify the scope of the annotations.
- EmbeddedStubs.swift is used to stub out (as unavailable and fatalError'd) the missing functionality.
2023-09-16 12:38:46 -07:00
Karoy Lorentey
a72544fb77 [stdlib] Speed up ObjectIdentifier-keyed dictionaries
ObjectIdentifier is used relatively frequently as the Key type for dictionaries, so it makes sense for it to implement single-shot hashing. This will lead to a measurable speedup in lookup/insertion performance.

rdar://88339458
2022-02-01 11:34:40 -08:00
Doug Gregor
9579390024 [SE-0304] Rename ConcurrentValue to Sendable 2021-03-18 22:48:20 -07:00
Doug Gregor
1a1f79c0de Introduce safety checkin for ConcurrentValue conformance.
Introduce checking of ConcurrentValue conformances:
- For structs, check that each stored property conforms to ConcurrentValue
- For enums, check that each associated value conforms to ConcurrentValue
- For classes, check that each stored property is immutable and conforms
  to ConcurrentValue

Because all of the stored properties / associated values need to be
visible for this check to work, limit ConcurrentValue conformances to
be in the same source file as the type definition.

This checking can be disabled by conforming to a new marker protocol,
UnsafeConcurrentValue, that refines ConcurrentValue.
UnsafeConcurrentValue otherwise his no specific meaning. This allows
both "I know what I'm doing" for types that manage concurrent access
themselves as well as enabling retroactive conformance, both of which
are fundamentally unsafe but also quite necessary.

The bulk of this change ended up being to the standard library, because
all conformances of standard library types to the ConcurrentValue
protocol needed to be sunk down into the standard library so they
would benefit from the checking above. There were numerous little
mistakes in the initial pass through the stsandard library types that
have now been corrected.
2021-02-04 03:45:09 -08:00
Nate Cook
a43cb01cbb Update ObjectIdentifier.swift
Co-authored-by: Xiaodi Wu <13952+xwu@users.noreply.github.com>
2020-10-23 15:13:03 -05:00
酷酷的哀殿
9c9c5da944 Update ObjectIdentifier.swift 2020-10-23 21:10:04 +08:00
酷酷的哀殿
16e541709e Update ObjectIdentifier.swift 2020-10-23 21:09:33 +08:00
酷酷的哀殿
a9af098560 Update ObjectIdentifier.swift 2020-10-22 22:43:31 +08:00
酷酷的哀殿
4a4c6c0f63 Update ObjectIdentifier.swift 2020-10-21 22:50:12 +08:00
酷酷的哀殿
c2159e2401 Update ObjectIdentifier.swift 2020-10-21 00:23:14 +08:00
酷酷的哀殿
59aff3e850 Update ObjectIdentifier.swift 2020-10-21 00:22:44 +08:00
酷酷的哀殿
e6fbb4b247 Update ObjectIdentifier.swift 2020-10-19 22:06:19 +08:00
酷酷的哀殿
cd74534052 [Docs] Clarifies ObjectIdentifier guarantees (#31472)
[SR-13564](https://bugs.swift.org/browse/SR-13564)
rdar://69169351
2020-10-19 21:54:50 +08:00
Paul Hudson
06f82a53b5 Replaced the majority of ' : ' with ': '. 2019-07-18 20:46:07 +01:00
Ben Cohen
e9d4687e31 De-underscore @frozen, apply it to structs (#24185)
* De-underscore @frozen for enums

* Add @frozen for structs, deprecate @_fixed_layout for them

* Switch usage from _fixed_layout to frozen
2019-05-30 17:55:37 -07:00
Ben Cohen
397c22bf8f ObjectIdentifier needs to be fast and is trivial 2018-10-29 07:42:07 -07:00
Ben Cohen
92b6d8cb8f Remove inlineability from mirrors (#17476) 2018-06-25 19:54:13 -07:00
Karoy Lorentey
07c1b74cc4 [stdlib] Audit inlinability of Hashable implementations
As a general rule, it is safe to mark the implementation of hash(into:) and _rawHashValue(seed:) for @_fixed_layout structs as inlinable.

However, some structs (like String guts, Character, KeyPath-related types) have complicated enough hashing that it seems counterproductive to inline them. Mark these with @effects(releasenone) instead.
2018-05-31 18:24:59 -07:00
Nate Cook
7a4e0a32f6 [stdlib] Revise documentation
This includes various revisions to the APIs landing in Swift 4.2, including:
- Random and other randomness APIs
- Hashable changes
- MemoryLayout.offset(of:)
2018-05-18 11:31:54 -05:00
Karoy Lorentey
0342ce3b96 [SE-0206][stdlib] Remove obsolete hashValue implementations
These are now synthesized by the compiler.
(Inlinability will be different, but that seems fine.)
2018-04-30 10:17:09 +01:00
Karoy Lorentey
239c2c91dd [SE-0206][stdlib] Add missing hash(into:) declarations 2018-04-30 10:17:09 +01:00
Timm Preetz
46d36c8136 [gardening] Correct comment 2018-04-21 11:34:02 +02:00
Slava Pestov
e1f50b2d36 SE-0193: Rename @_inlineable to @inlinable, @_versioned to @usableFromInline 2018-03-30 21:55:30 -07:00
ben-cohen
d67c5f0025 Part the fourth 2017-12-01 14:06:14 -08:00
Max Moiseev
a24998a5b1 [stdlib] Add missing @_fixed_layout attributes to fix resilience build 2017-10-02 15:19:06 -07:00
Max Moiseev
53b8419279 [stdlib] Make all the stdlib APIs @_inlineable
This change in theory should allow us to remove a special stdlib-only
sil-serialize-all compilation mode.

<rdar://problem/34138683>
2017-09-29 11:26:56 -07:00
Maxim Moiseev
ee5fb33656 [stdlib] Remove the Grand Renaming artifacts of Swift 3 era 2017-08-28 15:54:11 -07:00
Nate Cook
b7af9bfe83 [stdlib] Remove SeeAlso tags 2017-06-13 11:23:51 -05:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Dmitri Gribenko
46ef62db6e stdlib: move non-legacy parts of Reflection.swift into separate files 2016-09-03 17:39:55 -07:00