Skip to content

Commit b032d70

Browse files
authored
Merge pull request #80214 from al45tair/rename-unsafefirst
[Backtracing] Rename `unsafeFirst` to `consumingFirst`.
2 parents 16cefca + 75b9c8f commit b032d70

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

stdlib/public/libexec/swift-backtrace/Utils.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ extension Sequence {
211211
/// This is not, in general, a safe thing to do, because the sequence might
212212
/// not be restartable. For the cases where we're using it here, it's OK
213213
/// though.
214-
public var unsafeFirst: Element? {
214+
var consumingFirst: Element? {
215215
var iterator = makeIterator()
216216
return iterator.next()
217217
}

stdlib/public/libexec/swift-backtrace/main.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,14 +1008,14 @@ Generate a backtrace for the parent process.
10081008
let formatter = backtraceFormatter()
10091009
switch thread.backtrace {
10101010
case let .raw(backtrace):
1011-
if let frame = backtrace.frames.unsafeFirst {
1011+
if let frame = backtrace.frames.consumingFirst {
10121012
let formatted = formatter.format(frame: frame)
10131013
writeln("\(formatted)")
10141014
}
10151015
case let .symbolicated(backtrace):
10161016
if let frame = backtrace.frames.drop(while: {
10171017
$0.isSwiftRuntimeFailure
1018-
}).unsafeFirst {
1018+
}).consumingFirst {
10191019
let formatted = formatter.format(frame: frame)
10201020
writeln("\(formatted)")
10211021
}
@@ -1087,7 +1087,7 @@ Generate a backtrace for the parent process.
10871087

10881088
switch thread.backtrace {
10891089
case let .raw(backtrace):
1090-
if let frame = backtrace.frames.unsafeFirst {
1090+
if let frame = backtrace.frames.consumingFirst {
10911091
rows += formatter.formatRows(
10921092
frame: frame
10931093
).map{ row in
@@ -1103,7 +1103,7 @@ Generate a backtrace for the parent process.
11031103
case let .symbolicated(backtrace):
11041104
if let frame = backtrace.frames.drop(while: {
11051105
$0.isSwiftRuntimeFailure
1106-
}).unsafeFirst {
1106+
}).consumingFirst {
11071107
rows += formatter.formatRows(
11081108
frame: frame
11091109
).map{ row in

0 commit comments

Comments
 (0)