Skip to content

Commit 42dca84

Browse files
authored
Merge pull request swiftlang#40871 from troughton/patch-3
[stdlib] Make Range.init(_: ClosedRange<Bound>) inlinable
2 parents c356875 + 70e9b96 commit 42dca84

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

stdlib/public/core/Range.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,8 @@ extension Range where Bound: Strideable, Bound.Stride: SignedInteger {
315315
/// For example, passing a closed range with an upper bound of `Int.max`
316316
/// triggers a runtime error, because the resulting half-open range would
317317
/// require an upper bound of `Int.max + 1`, which is not representable as
318+
/// an `Int`.
319+
@inlinable // trivial-implementation
318320
public init(_ other: ClosedRange<Bound>) {
319321
let upperBound = other.upperBound.advanced(by: 1)
320322
self.init(_uncheckedBounds: (lower: other.lowerBound, upper: upperBound))

0 commit comments

Comments
 (0)