Skip to content

Commit 7e21faa

Browse files
authored
Merge pull request #10988 from rjmccall/noescape-exclusivity-restriction-is-an-error
2 parents 07f5b8d + 847bc86 commit 7e21faa

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,7 @@ ERROR(incorrect_explicit_closure_result,none,
267267
"declared closure result %0 is incompatible with contextual type %1",
268268
(Type, Type))
269269

270-
// FIXME: make this an error when we've fixed the Dispatch problem.
271-
WARNING(err_noescape_param_call,none,
270+
ERROR(err_noescape_param_call,none,
272271
"passing a %select{|closure which captures a }1non-escaping function "
273272
"parameter %0 to a call to a non-escaping function parameter can allow "
274273
"re-entrant modification of a variable",

test/expr/postfix/call/noescape-param-exclusivity.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
// FIXME: make these errors
44

55
func test0(fn: (() -> ()) -> ()) {
6-
fn { fn {} } // expected-warning {{passing a closure which captures a non-escaping function parameter 'fn' to a call to a non-escaping function parameter can allow re-entrant modification of a variable}}
6+
fn { fn {} } // expected-error {{passing a closure which captures a non-escaping function parameter 'fn' to a call to a non-escaping function parameter can allow re-entrant modification of a variable}}
77
}
88

99
func test1(fn: (() -> ()) -> ()) { // expected-note {{parameter 'fn' is implicitly non-escaping}}
1010
// TODO: infer that this function is noescape from its captures
1111
func foo() {
12-
fn { fn {} } // expected-warning {{can allow re-entrant modification}}
12+
fn { fn {} } // expected-error {{can allow re-entrant modification}}
1313
// expected-error@-1 {{declaration closing over non-escaping parameter 'fn' may allow it to escape}}
1414
}
1515
}
@@ -25,7 +25,7 @@ func test2(x: inout Int, fn: (() -> ()) -> ()) {
2525
}
2626

2727
func test3(fn: (() -> ()) -> ()) {
28-
{ myfn in myfn { fn {} } }(fn) // expected-warning {{can allow re-entrant modification}}
28+
{ myfn in myfn { fn {} } }(fn) // expected-error {{can allow re-entrant modification}}
2929
}
3030

3131
func test4(fn: (() -> ()) -> ()) { // expected-note {{parameter 'fn' is implicitly non-escaping}}

0 commit comments

Comments
 (0)