Skip to content

Commit 809b9f2

Browse files
committed
Add note about interior borrows
1 parent 7b170b5 commit 809b9f2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

active/0069-const-vs-static.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,13 @@ restriction).
180180
### static => static
181181

182182
It is illegal for a `static` to reference another `static` by value. It is
183-
required that all references be borrowed. If this were not required, then this
184-
sort of reference would require that the static being referenced fall into one
185-
of two categories:
183+
required that all references be borrowed. Additionally, not all kinds of borrows
184+
are allowed, only explicitly taking the address of another static is allowed.
185+
For example, interior borrows of fields and elements or accessing elements of an
186+
array are both disallowed.
187+
188+
If a by-value reference were allowed, then this sort of reference would require
189+
that the static being referenced fall into one of two categories:
186190

187191
1. It's an initializer pattern. This is the purpose of `const`, however.
188192
2. The values are kept in sync. This is currently technically infeasible.

0 commit comments

Comments
 (0)