File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
lib/SILOptimizer/Mandatory Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -547,6 +547,9 @@ void DiagnosticEmitter::emitObjectDiagnosticsForPartialApplyUses(
547
547
static bool isClosureCapture (MarkMustCheckInst *markedValue) {
548
548
SILValue val = markedValue->getOperand ();
549
549
550
+ // Sometimes we've mark-must-check'd a begin_access.
551
+ val = stripAccessMarkers (val);
552
+
550
553
// look past any project-box
551
554
if (auto *pbi = dyn_cast<ProjectBoxInst>(val))
552
555
val = pbi->getOperand ();
Original file line number Diff line number Diff line change @@ -3862,6 +3862,22 @@ func blackHoleKlassTestCase2(_ k: consuming Klass) {
3862
3862
// expected-note @-1 {{consumed again here}}
3863
3863
}
3864
3864
3865
+ // rdar://109908383
3866
+ struct NonCopyableStruct : ~ Copyable { }
3867
+ var globFn : ( ) -> ( ) = { }
3868
+ func forceEscaping( _ esc: @escaping ( ) -> ( ) ) {
3869
+ globFn = esc
3870
+ }
3871
+ func closureDiagnosticsSimple( ) {
3872
+ var s = NonCopyableStruct ( )
3873
+ let f = {
3874
+ _ = consume s // expected-error {{missing reinitialization of closure capture 's' after consume}} // expected-note {{consumed here}}
3875
+ s = NonCopyableStruct ( )
3876
+ }
3877
+ forceEscaping ( f)
3878
+ f ( )
3879
+ }
3880
+
3865
3881
///////////////////////////////////////
3866
3882
// Copyable Type in a Move Only Type //
3867
3883
///////////////////////////////////////
You can’t perform that action at this time.
0 commit comments