Skip to content

Commit 150d576

Browse files
committed
Clarify outlives rules on opaques with specified bounds
There is some subtlety in describing the mechanics of the outlives rules for `impl Trait` opaque types. In our description of these rules for opaque types that include a specified outlives bound, we had some words that were less clear than we had intended. Let's change those words around to make the meaning more clear. Specifically, rather saying that "it" outlives the specified lifetime, what we mean exactly is that the lifetime that's substituted for the specified lifetime parameter must outlive that other lifetime. Note that none of this language is normative. These rules have all been specified in earlier RFCs.
1 parent 92e715e commit 150d576

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

text/3498-lifetime-capture-rules-2024.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ In the above, we would say that the lifetime parameter `'a` has been captured in
3232

3333
For an opaque type that *does not* specify an outlives bound (e.g. `+ 'other`), when a caller receives a value of that opaque type and wants to prove that it outlives some lifetime, the caller must prove that all of the captured lifetime components of the opaque type outlive that lifetime. The captured lifetime components are the set of lifetimes contained within captured type parameters and the lifetimes represented by captured lifetime parameters.
3434

35-
For an opaque type that *does* specify an outlives bound (e.g. `+ 'other`), when a caller receives a value of that opaque type and wants to prove that it outlives some lifetime, it's enough to prove that it outlives the specified lifetime in the bounds of the opaque after transitively taking into account all known lifetime bounds. For such an opaque type, the *callee* must prove that all lifetime and type parameters that are used in the hidden type outlive the specified bound.
35+
For an opaque type that *does* specify an outlives bound (e.g. `+ 'other`), when a caller receives a value of that opaque type and wants to prove that it outlives some lifetime, it's enough to prove that the lifetime substituted for the specified lifetime parameter in the bounds of the opaque outlives that other lifetime after transitively taking into account all known lifetime bounds. For such an opaque type, the *callee* must prove that all lifetime and type parameters that are used in the hidden type outlive the specified bound.
3636

3737
## Capturing lifetimes in type parameters
3838

0 commit comments

Comments
 (0)