Skip to content

[stdlib] Set, Dictionary: Make reserveCapacity non-inlinable #19604

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions stdlib/public/core/Dictionary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,8 @@ public struct Dictionary<Key: Hashable, Value> {
/// - Parameter minimumCapacity: The minimum number of key-value pairs that
/// the newly created dictionary should be able to store without
/// reallocating its storage buffer.
@inlinable
public init(minimumCapacity: Int) {
public // FIXME(reserveCapacity): Should be inlinable
init(minimumCapacity: Int) {
_variant = .native(_NativeDictionary(capacity: minimumCapacity))
}

Expand Down Expand Up @@ -2074,8 +2074,8 @@ extension Dictionary {
///
/// - Parameter minimumCapacity: The requested number of key-value pairs to
/// store.
@inlinable
public mutating func reserveCapacity(_ minimumCapacity: Int) {
public // FIXME(reserveCapacity): Should be inlinable
mutating func reserveCapacity(_ minimumCapacity: Int) {
_variant.reserveCapacity(minimumCapacity)
_sanityCheck(self.capacity >= minimumCapacity)
}
Expand Down
1 change: 0 additions & 1 deletion stdlib/public/core/DictionaryVariant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ extension Dictionary._Variant {

/// Reserves enough space for the specified number of elements to be stored
/// without reallocating additional storage.
@inlinable
internal mutating func reserveCapacity(_ capacity: Int) {
switch self {
case .native:
Expand Down
1 change: 0 additions & 1 deletion stdlib/public/core/NativeDictionary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ extension _NativeDictionary { // ensureUnique
return true
}

@inlinable
internal mutating func reserveCapacity(_ capacity: Int, isUnique: Bool) {
_ = ensureUnique(isUnique: isUnique, capacity: capacity)
}
Expand Down
1 change: 0 additions & 1 deletion stdlib/public/core/NativeSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ extension _NativeSet { // ensureUnique
return true
}

@inlinable
internal mutating func reserveCapacity(_ capacity: Int, isUnique: Bool) {
_ = ensureUnique(isUnique: isUnique, capacity: capacity)
}
Expand Down
8 changes: 4 additions & 4 deletions stdlib/public/core/Set.swift
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ public struct Set<Element: Hashable> {
/// - Parameter minimumCapacity: The minimum number of elements that the
/// newly created set should be able to store without reallocating its
/// storage buffer.
@inlinable
public init(minimumCapacity: Int) {
public // FIXME(reserveCapacity): Should be inlinable
init(minimumCapacity: Int) {
_variant = .native(_NativeSet(capacity: minimumCapacity))
}

Expand Down Expand Up @@ -1590,8 +1590,8 @@ extension Set {
///
/// - Parameter minimumCapacity: The requested number of elements to
/// store.
@inlinable
public mutating func reserveCapacity(_ minimumCapacity: Int) {
public // FIXME(reserveCapacity): Should be inlinable
mutating func reserveCapacity(_ minimumCapacity: Int) {
_variant.reserveCapacity(minimumCapacity)
_sanityCheck(self.capacity >= minimumCapacity)
}
Expand Down
1 change: 0 additions & 1 deletion stdlib/public/core/SetVariant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ extension Set._Variant {

/// Reserves enough space for the specified number of elements to be stored
/// without reallocating additional storage.
@inlinable
internal mutating func reserveCapacity(_ capacity: Int) {
switch self {
case .native:
Expand Down