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(
547547static bool isClosureCapture (MarkMustCheckInst *markedValue) {
548548 SILValue val = markedValue->getOperand ();
549549
550+ // Sometimes we've mark-must-check'd a begin_access.
551+ val = stripAccessMarkers (val);
552+
550553 // look past any project-box
551554 if (auto *pbi = dyn_cast<ProjectBoxInst>(val))
552555 val = pbi->getOperand ();
Original file line number Diff line number Diff line change @@ -3862,6 +3862,22 @@ func blackHoleKlassTestCase2(_ k: consuming Klass) {
38623862 // expected-note @-1 {{consumed again here}}
38633863}
38643864
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+
38653881///////////////////////////////////////
38663882// Copyable Type in a Move Only Type //
38673883///////////////////////////////////////
You can’t perform that action at this time.
0 commit comments