@@ -1243,16 +1243,17 @@ int foo(in int x, out int y, ref int z, int q);
1243
1243
for its type)
1244
1244
1245
1245
$(TROW $(D scope), $(ARGS
1246
- The parameter does not escape the function call
1246
+ The parameter must not escape the function call
1247
1247
(e.g. by being assigned to a global variable).
1248
1248
Ignored for any parameter that is not a reference type.
1249
- Escape analysis is only done for `@safe` functions, for other functions `scope` semantics must
1250
- be manually enforced.
1251
- As the parameter must not escape, the compiler can avoid heap-allocation of a unique argument
1252
- to a `scope` parameter. Due to this, passing e.g. a `new T` argument may not violate `@nogc`.
1253
- A typical example of this is passing a delegate literal to a `scope` parameter.
1254
- $(B Note): `scope` escape analysis is currently only done by `dmd`
1255
- when the `-dip1000` switch is passed.
1249
+ `scope` escape analysis is only done for `@safe` functions. For other functions `scope`
1250
+ semantics must be manually enforced.)
1251
+ $(P $(B Note): `scope` escape analysis is currently only done by `dmd`
1252
+ when the `-dip1000` switch is passed.)
1253
+ $(P As the parameter must not escape, the compiler can potentially avoid heap-allocation of a
1254
+ unique argument to a `scope` parameter. Due to this, passing an array literal, delegate
1255
+ literal or a $(GLINK2 expression, NewExpression) to a scope parameter may be used in a
1256
+ `@nogc` context, depending on the compiler implementation.)
1256
1257
))
1257
1258
$(TROW $(D return), $(ARGS Parameter may be returned or copied to the first parameter,
1258
1259
but otherwise does not escape from the function.
0 commit comments