Skip to content

Commit 55eaa7f

Browse files
committed
[stdlib] Add some missing '@usableFromInline's
Caught by the rule I'm about to add in the next commit: a fixed-layout struct must only contain public/@usableFromInline members.
1 parent 314da03 commit 55eaa7f

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

stdlib/public/core/Hasher.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
import SwiftShims
1818

19+
// FIXME: Remove @usableFromInline once Hasher is resilient.
20+
// rdar://problem/38549901
21+
@usableFromInline
1922
internal protocol _HasherCore {
2023
init(seed: (UInt64, UInt64))
2124
mutating func compress(_ value: UInt64)
@@ -74,6 +77,9 @@ internal func _loadPartialUnalignedUInt64LE(
7477
/// trailing bytes, while the most significant 8 bits hold the count of bytes
7578
/// appended so far, modulo 256. The count of bytes currently stored in the
7679
/// buffer is in the lower three bits of the byte count.)
80+
// FIXME: Remove @usableFromInline and @_fixed_layout once Hasher is resilient.
81+
// rdar://problem/38549901
82+
@usableFromInline @_fixed_layout
7783
internal struct _HasherTailBuffer {
7884
// msb lsb
7985
// +---------+-------+-------+-------+-------+-------+-------+-------+
@@ -146,6 +152,9 @@ internal struct _HasherTailBuffer {
146152
}
147153
}
148154

155+
// FIXME: Remove @usableFromInline and @_fixed_layout once Hasher is resilient.
156+
// rdar://problem/38549901
157+
@usableFromInline @_fixed_layout
149158
internal struct _BufferingHasher<Core: _HasherCore> {
150159
private var _buffer: _HasherTailBuffer
151160
private var _core: Core
@@ -278,7 +287,13 @@ internal struct _BufferingHasher<Core: _HasherCore> {
278287
/// versions of the standard library.
279288
@_fixed_layout // FIXME: Should be resilient (rdar://problem/38549901)
280289
public struct Hasher {
290+
// FIXME: Remove @usableFromInline once Hasher is resilient.
291+
// rdar://problem/38549901
292+
@usableFromInline
281293
internal typealias RawCore = _SipHash13Core
294+
// FIXME: Remove @usableFromInline once Hasher is resilient.
295+
// rdar://problem/38549901
296+
@usableFromInline
282297
internal typealias Core = _BufferingHasher<RawCore>
283298

284299
internal var _core: Core

stdlib/public/core/SipHash.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919
/// * Daniel J. Bernstein <[email protected]>
2020
//===----------------------------------------------------------------------===//
2121

22-
private struct _SipHashState {
22+
// FIXME: Remove @usableFromInline and @_fixed_layout once Hasher is resilient.
23+
// rdar://problem/38549901
24+
@usableFromInline @_fixed_layout
25+
internal struct _SipHashState {
2326
// "somepseudorandomlygeneratedbytes"
2427
fileprivate var v0: UInt64 = 0x736f6d6570736575
2528
fileprivate var v1: UInt64 = 0x646f72616e646f6d
@@ -69,6 +72,9 @@ private struct _SipHashState {
6972
}
7073
}
7174

75+
// FIXME: Remove @usableFromInline and @_fixed_layout once Hasher is resilient.
76+
// rdar://problem/38549901
77+
@usableFromInline @_fixed_layout
7278
internal struct _SipHash13Core: _HasherCore {
7379
private var _state: _SipHashState
7480

0 commit comments

Comments
 (0)