[Strict memory safety] Nested types are safe/unsafe independent of their enclosing type

When determining whether a nested type is safe, don't consider whether
its enclosing type is safe. They're independent.
This commit is contained in:
Doug Gregor
2025-04-19 09:49:22 -07:00
parent fe6856726e
commit 8ec52c825c
3 changed files with 124 additions and 16 deletions

View File

@@ -277,6 +277,15 @@ struct UnsafeContainingUnspecified {
typealias A = Int
func getA() -> A { 0 }
@safe
struct Y {
var value: Int
}
func f() {
_ = Y(value: 5)
}
}