diff --git a/spec/function.dd b/spec/function.dd index a6de616004..843f33b3a2 100644 --- a/spec/function.dd +++ b/spec/function.dd @@ -3329,6 +3329,16 @@ $(H3 $(LNAME2 trusted-functions, Trusted Functions)) that they are easier to manually verify. ) + $(BEST_PRACTICE Do not use `@trusted` nested functions in order to introduce + unsafe code into `@safe` code. Such functions tend to hide their presence + inside `@safe` code. Nested functions can manipulate variables in their + caller's scope leading to difficulty in manually verifying that it has an + `@safe` interface. + Instead, `@trusted` functions should be non-nested with a carefully designed + `@safe` interface. + `@trusted` nested functions may be deprecated in the future. + ) + $(H3 $(LNAME2 system-functions, System Functions)) $(P System functions are functions not marked with $(CODE @safe) or