Skip to content

Commit fe84774

Browse files
authored
[spec/function] Fix Safe Interface definition (#3789)
* [spec] Fix Safe interface definition 1. Mention context and globals for preconditions. Part of Bugzilla 24098 - Safe variable can be initialized from `@system` static constructor. 2. `@trusted` functions can create unsafe values/aliasing so long as they are not accessible from `@safe` code. * Add link to delegates
1 parent f61c6da commit fe84774

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

spec/function.dd

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3906,18 +3906,19 @@ $(H3 $(LNAME2 system-functions, System Functions))
39063906

39073907
$(H3 $(LNAME2 safe-interfaces, Safe Interfaces))
39083908

3909-
$(P When it is only called with $(RELATIVE_LINK2 safe-values, safe
3910-
values) and $(RELATIVE_LINK2 safe-aliasing, safe aliasing), a
3909+
$(P When a function call's arguments, $(RELATIVE_LINK2 closures, any context)
3910+
and accessible globals each have $(RELATIVE_LINK2 safe-values, safe
3911+
values) with $(RELATIVE_LINK2 safe-aliasing, safe aliasing), that
39113912
function has a safe interface when:)
39123913
$(OL
39133914
$(LI it cannot exhibit
39143915
$(DDSUBLINK spec/glossary, undefined_behavior, undefined behavior),
39153916
and)
3916-
$(LI it cannot create unsafe values that are accessible from other
3917-
parts of the program (e.g., via return values, global variables,
3917+
$(LI it cannot create unsafe values that are accessible from
3918+
`@safe` code (e.g., via return values, global variables,
39183919
or `ref` parameters), and)
39193920
$(LI it cannot introduce unsafe aliasing that is accessible from
3920-
other parts of the program.)
3921+
`@safe` code.)
39213922
)
39223923

39233924
$(P Functions that meet these requirements may be

0 commit comments

Comments
 (0)