Skip to content

Commit cfd33b0

Browse files
committed
clarify liveness rules
1 parent 70ae397 commit cfd33b0

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/behavior-considered-undefined.md

+4-7
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,10 @@ r[undefined.alias]
4949
`Box<T>` is treated similar to `&'static mut T` for the purpose of these rules.
5050
The exact liveness duration is not specified, but some bounds exist:
5151
* For references, the liveness duration is upper-bounded by the syntactic
52-
lifetime assigned by the borrow checker; it cannot be live any *longer* than
53-
that lifetime.
54-
* Each time a reference or box is passed to or returned from a function, it is
55-
considered live.
56-
* When a reference (but not a `Box`!) is passed to a function, it is live at
57-
least as long as that function call, again except if the `&T` contains an
58-
[`UnsafeCell<U>`].
52+
lifetime assigned by the borrow checker; it cannot be live any *longer* than that lifetime.
53+
* Each time a reference or box is dereferenced or reborrowed, it is considered live.
54+
* Each time a reference or box is passed to or returned from a function, it is considered live.
55+
* When a reference (but not a `Box`!) is passed to a function, it is live at least as long as that function call, again except if the `&T` contains an [`UnsafeCell<U>`].
5956

6057
All this also applies when values of these types are passed in a (nested) field of a compound type, but not behind pointer indirections.
6158

0 commit comments

Comments
 (0)