mirror of
https://github.com/apple/swift-collections
synced 2026-11-28 05:04:21 +00:00
Review error handling
This commit is contained in:
16 files changed
+148
-126
No files matched your search
@@ -349,10 +349,11 @@ extension RigidArray {
|
||||
#if compiler(>=6.4) && UnstableContainersPreview
|
||||
@inlinable
|
||||
internal mutating func _append<
|
||||
Source: Iterable_<Element, E> & ~Copyable & ~Escapable, E
|
||||
Source: Iterable_ & ~Copyable & ~Escapable
|
||||
>(
|
||||
copying newElements: borrowing Source
|
||||
) throws(E) {
|
||||
) throws(Source.Failure_)
|
||||
where Source.Element_ == Element {
|
||||
let target = _freeSpace
|
||||
_count += try newElements._copyContents(intoPrefixOf: target)
|
||||
}
|
||||
@@ -371,10 +372,11 @@ extension RigidArray {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public mutating func append<
|
||||
Source: Iterable_<Element, E> & ~Copyable & ~Escapable, E
|
||||
Source: Iterable_ & ~Copyable & ~Escapable
|
||||
>(
|
||||
copying newElements: borrowing Source
|
||||
) throws(E) {
|
||||
) throws(Source.Failure_)
|
||||
where Source.Element_ == Element {
|
||||
try _append(copying: newElements)
|
||||
}
|
||||
#endif
|
||||
@@ -413,9 +415,12 @@ extension RigidArray {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public mutating func append<
|
||||
Source: Iterable_<Element, Never> & Sequence<Element>
|
||||
>(copying newElements: Source) {
|
||||
_append(copying: newElements)
|
||||
Source: Iterable_ & Sequence<Element>
|
||||
>(
|
||||
copying newElements: Source
|
||||
) throws(Source.Failure_)
|
||||
where Source.Element_ == Element {
|
||||
try _append(copying: newElements)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -124,10 +124,11 @@ extension RigidArray /*where Element: Copyable*/ {
|
||||
/// The container must not contain more than `capacity` elements.
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public init<Source: Iterable_<Element, E> & ~Copyable & ~Escapable, E>(
|
||||
public init<Source: Iterable_ & ~Copyable & ~Escapable>(
|
||||
capacity: Int,
|
||||
copying contents: borrowing Source
|
||||
) throws(E) {
|
||||
) throws(Source.Failure_)
|
||||
where Source.Element_ == Element {
|
||||
self.init(capacity: capacity)
|
||||
try self.append(copying: contents)
|
||||
}
|
||||
@@ -145,12 +146,13 @@ extension RigidArray /*where Element: Copyable*/ {
|
||||
/// The container must not contain more than `capacity` elements.
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
public init<Source: Iterable_<Element, Never> & Sequence<Element>>(
|
||||
public init<Source: Iterable_ & Sequence<Element>>(
|
||||
capacity: Int,
|
||||
copying contents: Source
|
||||
) {
|
||||
) throws(Source.Failure_)
|
||||
where Source.Element_ == Element {
|
||||
self.init(capacity: capacity)
|
||||
self.append(copying: contents)
|
||||
try self.append(copying: contents)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in new issue
Block a user