Skip to content

Commit 5e8d273

Browse files
committed
Permit multiple lifetime bounds on parameter types.
1 parent a6d22fd commit 5e8d273

File tree

1 file changed

+3
-21
lines changed

1 file changed

+3
-21
lines changed

active/0049-bounds-on-object-and-generic-types.md

+3-21
Original file line numberDiff line numberDiff line change
@@ -69,24 +69,6 @@ declared:
6969
Here, the constraint `T:'a` indicates that the data being iterated
7070
over must live at least as long as the collection (logically enough).
7171

72-
### At most one explicit lifetime bound is permitted
73-
74-
For simplicity, we permit at most one *explicit* lifetime bound on any
75-
given parameter type. That means that the following function is illegal:
76-
77-
fn foo<'a,'b,A:'a+'b>() { ... }
78-
79-
Remember that if there are multiple lifetime bounds, it implies that
80-
all of them must hold. That means that if, in fact, `A` outlives both
81-
`'a` and `'b` then either one of them is shorter than the other, the
82-
two are the same, or there is a third lifetime that outlives them
83-
both. Therefore, the function above can be rewritten as follows (using
84-
explicit lifetime bounds, specified below):
85-
86-
fn foo<'a,'b,'c:'a+'b,A:'c>() { ... }
87-
88-
As far as I know, this situation has not arisen once in the codebase.
89-
9072
## Lifetime bounds on object types
9173

9274
Like parameters, all object types have a lifetime bound. Unlike
@@ -113,9 +95,9 @@ Here are some examples:
11395
// IsStatic+'a 'static+'a
11496
// IsStatic+Is<'a>+'b 'static,'a,'b
11597

116-
In general no object type is permitted to have zero bounds. Therefore,
117-
if an object type with no derivable bounds appears, we will supply a
118-
default lifetime using the normal rules:
98+
Object types must have exactly one bound -- zero bounds is not
99+
acceptable. Therefore, if an object type with no derivable bounds
100+
appears, we will supply a default lifetime using the normal rules:
119101

120102
trait Writer { /* no derivable bounds */ }
121103
struct Foo<'a> {

0 commit comments

Comments
 (0)