[Strict memory safety] Update standard library for nested safe/unsafe types

Use this to mark a few internal types @safe now that it works properly.
This commit is contained in:
Doug Gregor
2025-04-19 19:54:32 -07:00
parent 53ca902267
commit 457eb4cc64
18 changed files with 326 additions and 315 deletions

View File

@@ -247,11 +247,11 @@ extension __RawDictionaryStorage {
var bucket = unsafe hashTable.idealBucket(forHashValue: hashValue)
while unsafe hashTable._isOccupied(bucket) {
if unsafe uncheckedKey(at: bucket) == key {
return unsafe (bucket, true)
return (bucket, true)
}
unsafe bucket = unsafe hashTable.bucket(wrappedAfter: bucket)
}
return unsafe (bucket, false)
return (bucket, false)
}
}
@@ -358,7 +358,7 @@ final internal class _DictionaryStorage<Key: Hashable, Value>
"Invalid fast enumeration state")
var stored = 0
for i in 0..<count {
if unsafe bucket == endBucket { break }
if bucket == endBucket { break }
let key = unsafe _keys[bucket.offset]
unsafe unmanagedObjects[i] = _bridgeAnythingToObjectiveC(key)
@@ -479,7 +479,7 @@ extension _DictionaryStorage {
bucketCount._builtinWordValue, Value.self)
let metadataAddr = unsafe Builtin.projectTailElems(storage, _HashTable.Word.self)
let keysAddr = unsafe Builtin.getTailAddr_Word(
let keysAddr = Builtin.getTailAddr_Word(
metadataAddr, wordCount._builtinWordValue, _HashTable.Word.self,
Key.self)
let valuesAddr = Builtin.getTailAddr_Word(