File tree 2 files changed +9
-1
lines changed
2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -443,7 +443,7 @@ void swift::checkUnsafeStorage(NominalTypeDecl *nominal) {
443
443
444
444
// Look for any unsafe storage in this nominal type.
445
445
SmallVector<UnsafeUse, 4 > unsafeUses;
446
- UnsafeStorageVisitor (ctx, unsafeUses).visit (nominal, nominal-> getDeclContext () );
446
+ UnsafeStorageVisitor (ctx, unsafeUses).visit (nominal, nominal);
447
447
448
448
// If we didn't find any unsafe storage, there's nothing to do.
449
449
if (unsafeUses.empty ())
Original file line number Diff line number Diff line change @@ -191,3 +191,11 @@ class ClassWithUnsafeStorage {
191
191
var int : Int = 0
192
192
var array : [ UnsafeSuper ] ? = nil // expected-note{{property 'array' involves unsafe type 'UnsafeSuper'}}
193
193
}
194
+
195
+ // expected-warning@+3{{generic struct 'GenericStructWithUnsafeThings' has storage involving unsafe types}}
196
+ // expected-note@+2{{add '@unsafe' if this type is also unsafe to use}}
197
+ // expected-note@+1{{add '@safe' if this type encapsulates the unsafe storage in a safe interface}}
198
+ struct GenericStructWithUnsafeThings < T> {
199
+ var property : T
200
+ var pointer : PointerType // expected-note{{property 'pointer' involves unsafe type 'PointerType'}}
201
+ }
You can’t perform that action at this time.
0 commit comments