You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: proposals/NNNN-lifetime-dependency.md
+9-2Lines changed: 9 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -420,7 +420,7 @@ Requiring an explicit mutation specification seems to us to improve readability,
420
420
421
421
## Future Directions
422
422
423
-
#### **Lifetime Dependencies for Computed Properties**
423
+
#### Lifetime Dependencies for Computed Properties
424
424
425
425
It might be useful to allow lifetime dependencies between `self` and the value returned by a computed property.
426
426
There is some ambiguity here, since resilience hides the distinction between a computed and stored property, and it’s not clear that there is any use for lifetime dependencies when returning stored properties.
@@ -447,7 +447,7 @@ This simplifies the model by identifying `~Escapable` types as exactly those typ
447
447
It also helps simplify the enforcement of lifetime constraints by guaranteeing that constrained values cannot escape before being returned.
448
448
We expect that in the future, additional investigation can reveal a way to relax this restriction.
449
449
450
-
### Downgraded Dependencies
450
+
####Downgraded Dependencies
451
451
452
452
```
453
453
// This is forbidden by the current proposal, but could be supported in theory
@@ -459,4 +459,11 @@ It may be useful to permit “downgrading” the access so that the function can
459
459
We are not confident that we can make this fully safe today: With our current diagnostic work, we cannot prevent the implementor of `f` from “sneaking” read-write access into the returned value.
460
460
We hope to expand these diagnostics in the future, at which point we may be able to safely lift this restriction.
461
461
462
+
#### Lifetime Dependencies between arguments
462
463
464
+
A caller may need assurance that a callee will honor a lifetime dependency between two arguments.
465
+
For example, if a function is going to destroy a container and a reference to that container in the process of computing some result,
466
+
it needs to guarantee that the reference is destroyed before the container:
0 commit comments