Skip to content

Commit 03d2017

Browse files
committed
reword 'other consume here' to 'consumed again here'
this also fixes a bug where sometimes we simply emit 'consumed here' twice and other times we'd said 'other consume here' for the same "consumed more than once" message. so I went through and changed all of the 2nd consumes into "consumed again". rdar://109281444
1 parent 71763a1 commit 03d2017

12 files changed

+542
-543
lines changed

include/swift/AST/DiagnosticsSIL.def

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -780,8 +780,8 @@ NOTE(sil_movechecking_partial_consume_here, none,
780780
"partially consumed here", ())
781781
NOTE(sil_movechecking_consuming_use_here, none,
782782
"consumed here", ())
783-
NOTE(sil_movechecking_other_consuming_use_here, none,
784-
"other consume here", ())
783+
NOTE(sil_movechecking_consumed_again_here, none,
784+
"consumed again here", ())
785785
NOTE(sil_movechecking_two_consuming_uses_here, none,
786786
"multiple consumes here", ())
787787
NOTE(sil_movechecking_consuming_and_non_consuming_uses_here, none,
@@ -799,8 +799,7 @@ NOTE(sil_movechecking_deinit_here, none,
799799
ERROR(sil_movechecking_not_understand_consumable_and_assignable, none,
800800
"usage of no-implicit-copy value that the compiler can't verify. This is a compiler bug. Please file a bug with a small example of the bug", ())
801801
ERROR(sil_movechecking_not_understand_moveonly, none,
802-
"usage of a noncopyable type that compiler can't verify. This is a compiler bug. Please file a bug with a small example of the bug"
803-
"check!", ())
802+
"usage of a noncopyable type that compiler can't verify. This is a compiler bug. Please file a bug with a small example of the bug", ())
804803
ERROR(sil_movechecking_bug_missed_copy, none,
805804
"copy of noncopyable typed value. This is a compiler bug. Please file a bug with a small example of the bug", ())
806805
ERROR(sil_movechecking_bug_exclusivity_violation, none,

lib/SILOptimizer/Mandatory/MoveOnlyDiagnostics.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ void DiagnosticEmitter::emitObjectOwnedDiagnostic(
285285
diagnose(astContext, user,
286286
diag::sil_movechecking_consuming_use_here);
287287
diagnose(astContext, &*ii,
288-
diag::sil_movechecking_other_consuming_use_here);
288+
diag::sil_movechecking_consumed_again_here);
289289
break;
290290
}
291291

@@ -333,7 +333,7 @@ void DiagnosticEmitter::emitObjectOwnedDiagnostic(
333333
diagnose(astContext, user,
334334
diag::sil_movechecking_consuming_use_here);
335335
diagnose(astContext, iter->second,
336-
diag::sil_movechecking_other_consuming_use_here);
336+
diag::sil_movechecking_consumed_again_here);
337337
break;
338338
}
339339
}
@@ -476,7 +476,7 @@ void DiagnosticEmitter::emitAddressDiagnostic(MarkMustCheckInst *markedValue,
476476
diagnose(astContext, violatingUser,
477477
diag::sil_movechecking_consuming_use_here);
478478
diagnose(astContext, lastLiveUser,
479-
diag::sil_movechecking_consuming_use_here);
479+
diag::sil_movechecking_consumed_again_here);
480480
return;
481481
}
482482

test/SILGen/moveonly_escaping_closure.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func testLocalLetClosureCaptureVar() {
137137
borrowVal(x)
138138
consumeVal(x) // expected-note {{consumed here}}
139139
consumeVal(x) // expected-note {{consumed here}}
140-
// expected-note @-1 {{consumed here}}
140+
// expected-note @-1 {{consumed again here}}
141141
borrowConsumeVal(x, x)
142142
// expected-error @-1 {{overlapping accesses, but deinitialization requires exclusive access}}
143143
// expected-note @-2 {{conflicting access is here}}
@@ -940,7 +940,7 @@ func testLocalLetClosureCaptureConsuming(_ x: consuming SingleElt) {
940940
borrowVal(x)
941941
consumeVal(x) // expected-note {{consumed here}}
942942
consumeVal(x) // expected-note {{consumed here}}
943-
// expected-note @-1 {{consumed here}}
943+
// expected-note @-1 {{consumed again here}}
944944
borrowConsumeVal(x, x) // expected-note {{used here}}
945945
// expected-error @-1 {{overlapping accesses, but deinitialization requires exclusive access}}
946946
// expected-note @-2 {{conflicting access is here}}

test/SILOptimizer/moveonly_addresschecker_diagnostics.sil

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ bb0(%0 : $Int):
112112
%20 = move_value %19 : $Klass
113113
destroy_value %20 : $Klass
114114
destroy_value %17 : $Klass
115-
%23 = load [copy] %3 : $*AggStruct // expected-note {{consumed here}}
115+
%23 = load [copy] %3 : $*AggStruct // expected-note {{consumed again here}}
116116
destroy_addr %3 : $*AggStruct
117117
dealloc_stack %2 : $*AggStruct
118118
return %23 : $AggStruct
@@ -145,7 +145,7 @@ bb2(%55 : $Int):
145145
%58 = struct_element_addr %57 : $*KlassPair, #KlassPair.lhs
146146
%59 = load [copy] %58 : $*Klass
147147
// expected-note @-1 {{consumed here}}
148-
// expected-note @-2 {{consumed here}}
148+
// expected-note @-2 {{consumed again here}}
149149
end_access %56 : $*AggStruct
150150
%61 = function_ref @classConsume : $@convention(thin) (@owned Klass) -> ()
151151
%62 = apply %61(%59) : $@convention(thin) (@owned Klass) -> ()
@@ -214,7 +214,7 @@ bb0(%arg : @owned $NonTrivialStruct, %arg1 : @owned $NonTrivialStruct):
214214
%24 = apply %23(%21) : $@convention(thin) (@owned Klass) -> ()
215215
%25 = begin_access [read] [static] %1 : $*NonTrivialStruct
216216
%26 = struct_element_addr %25 : $*NonTrivialStruct, #NonTrivialStruct.k
217-
%27 = load [copy] %26 : $*Klass // expected-note {{consumed here}}
217+
%27 = load [copy] %26 : $*Klass // expected-note {{consumed again here}}
218218
end_access %25 : $*NonTrivialStruct
219219
%29 = function_ref @classConsume : $@convention(thin) (@owned Klass) -> ()
220220
%30 = apply %29(%27) : $@convention(thin) (@owned Klass) -> ()
@@ -266,7 +266,7 @@ bb0(%0 : @owned $NonTrivialStruct):
266266
destroy_value %11 : $@callee_guaranteed () -> ()
267267
%14 = alloc_stack $NonTrivialStruct, let, name "x3"
268268
%15 = mark_must_check [consumable_and_assignable] %14 : $*NonTrivialStruct
269-
%16 = load [copy] %4 : $*NonTrivialStruct // expected-note {{consumed here}}
269+
%16 = load [copy] %4 : $*NonTrivialStruct // expected-note {{consumed again here}}
270270
store %16 to [init] %15 : $*NonTrivialStruct
271271
%18 = load [copy] %15 : $*NonTrivialStruct
272272
%19 = move_value %18 : $NonTrivialStruct
@@ -314,7 +314,7 @@ bb0(%0 : $*Klass):
314314
%8 = begin_access [read] [static] %1 : $*Klass
315315
%9 = load [copy] %8 : $*Klass
316316
// expected-note @-1 {{consumed here}}
317-
// expected-note @-2 {{consumed here}}
317+
// expected-note @-2 {{consumed again here}}
318318
end_access %8 : $*Klass
319319
%11 = begin_access [modify] [static] %4 : $*Klass
320320
store %9 to [assign] %11 : $*Klass

0 commit comments

Comments
 (0)