Skip to content

Commit 24755cc

Browse files
committed
Merge remote-tracking branch 'origin/master' into master-next
2 parents 5f7255f + cc49e68 commit 24755cc

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

stdlib/private/SwiftPrivateThreadExtras/SwiftPrivateThreadExtras.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,15 @@ public func _stdlib_thread_join<Result>(
120120
let result = WaitForSingleObject(thread, 0xffffffff);
121121
// TODO(compnerd) modularize WinBase.h for WAIT_OBJECT_0 (0)
122122
if result == 0 {
123-
let threadResult: DWORD = 0
123+
var threadResult: DWORD = 0
124124
GetExitCodeThread(thread, &threadResult)
125125
CloseHandle(thread)
126126

127-
return (result,
127+
return (CInt(result),
128128
UnsafeMutablePointer<DWORD>(&threadResult)
129129
.withMemoryRebound(to: Result.self, capacity: 1){ $0.pointee })
130130
} else {
131-
return (result, nil)
131+
return (CInt(result), nil)
132132
}
133133
#else
134134
var threadResultRawPtr: UnsafeMutableRawPointer?

stdlib/public/core/DictionaryCasting.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
public func _dictionaryUpCast<DerivedKey, DerivedValue, BaseKey, BaseValue>(
2222
_ source: Dictionary<DerivedKey, DerivedValue>
2323
) -> Dictionary<BaseKey, BaseValue> {
24-
var result = Dictionary<BaseKey, BaseValue>(minimumCapacity: source.count)
24+
var builder = _DictionaryBuilder<BaseKey, BaseValue>(count: source.count)
2525

2626
for (k, v) in source {
27-
result[k as! BaseKey] = (v as! BaseValue)
27+
builder.add(key:k as! BaseKey, value: v as! BaseValue)
2828
}
29-
return result
29+
return builder.take()
3030
}
3131

3232
/// Called by the casting machinery.
@@ -98,11 +98,11 @@ public func _dictionaryDownCastConditional<
9898
_ source: Dictionary<BaseKey, BaseValue>
9999
) -> Dictionary<DerivedKey, DerivedValue>? {
100100

101-
var result = Dictionary<DerivedKey, DerivedValue>()
101+
var builder = _DictionaryBuilder<DerivedKey, DerivedValue>(count: source.count)
102102
for (k, v) in source {
103103
guard let k1 = k as? DerivedKey, let v1 = v as? DerivedValue
104104
else { return nil }
105-
result[k1] = v1
105+
builder.add(key: k1, value: v1)
106106
}
107-
return result
107+
return builder.take()
108108
}

0 commit comments

Comments
 (0)