Skip to content

Commit 95a6719

Browse files
committed
ManualOwnership: introduce 'SemanticCopies' diagnostic group
This includes documentation to explain how to understand these diagnostics.
1 parent 7e8d8b6 commit 95a6719

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

include/swift/AST/DiagnosticGroups.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ GROUP(ProtocolTypeNonConformance, "protocol-type-non-conformance")
7373
GROUP(RegionIsolation, "region-isolation")
7474
GROUP(ResultBuilderMethods, "result-builder-methods")
7575
GROUP(ReturnTypeImplicitCopy, "return-type-implicit-copy")
76+
GROUP(SemanticCopies, "semantic-copies")
7677
GROUP(SendableClosureCaptures, "sendable-closure-captures")
7778
GROUP(SendableMetatypes, "sendable-metatypes")
7879
GROUP(SendingClosureRisksDataRace, "sending-closure-risks-data-race")

include/swift/AST/DiagnosticsSIL.def

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -433,13 +433,13 @@ ERROR(wrong_linkage_for_serialized_function,none,
433433
"function has wrong linkage to be called from %0", (StringRef))
434434
NOTE(performance_called_from,none,
435435
"called from here", ())
436-
ERROR(manualownership_copy,none,
437-
"explicit 'copy' required here; please report this vague diagnostic as a bug", ())
438-
ERROR(manualownership_copy_happened,none,
436+
GROUPED_WARNING(manualownership_copy,SemanticCopies,none,
437+
"implicit 'copy' happens here; please report this vague diagnostic as a bug", ())
438+
GROUPED_WARNING(manualownership_copy_happened,SemanticCopies,none,
439439
"accessing %0 may produce a copy; write 'copy' to acknowledge or 'consume' to elide", (Identifier))
440-
ERROR(manualownership_copy_demanded,none,
440+
GROUPED_WARNING(manualownership_copy_demanded,SemanticCopies,none,
441441
"independent copy of %0 is required here; write 'copy' to acknowledge or 'consume' to elide", (Identifier))
442-
ERROR(manualownership_copy_captured,none,
442+
GROUPED_WARNING(manualownership_copy_captured,SemanticCopies,none,
443443
"closure capture of '%0' requires independent copy of it; write [%0 = copy %0] in the closure's capture list to acknowledge", (StringRef))
444444

445445
// 'transparent' diagnostics

test/SIL/manual_ownership.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %target-swift-frontend %s -emit-sil -verify \
2+
// RUN: -Werror SemanticCopies \
23
// RUN: -enable-experimental-feature ManualOwnership
34

45
// REQUIRES: swift_feature_ManualOwnership
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Semantic Copies (Experimental Diagnostics)
2+
3+
TODO explain

0 commit comments

Comments
 (0)