@@ -366,7 +366,7 @@ For example, in practice, many iterator implementation break due to
366
366
region relationships:
367
367
368
368
``` rust
369
- impl <'a , T > IntoIterator for & 'a LinkedList <T > {
369
+ impl <'a , T > IntoIterator for & 'a LinkedList <T > {
370
370
type Item = & 'a T ;
371
371
...
372
372
}
@@ -402,14 +402,14 @@ types:
402
402
| T // Type
403
403
O = for<r..> TraitId<P1..Pn> // Object type fragment
404
404
r = 'x // Region name
405
-
405
+
406
406
We'll use this to describe the rules in detail.
407
407
408
408
A quick note on terminology: an "object type fragment" is part of an
409
409
object type: so if you have ` Box<FnMut()+Send> ` , ` FnMut() ` and ` Send `
410
410
are object type fragments. Object type fragments are identical to full
411
411
trait references, except that they do not have a self type (no ` P0 ` ).
412
-
412
+
413
413
### Syntactic definition of the outlives relation
414
414
415
415
The outlives relation is defined in purely syntactic terms as follows.
@@ -454,8 +454,8 @@ or projections are involved:
454
454
OutlivesFragment:
455
455
∀i. R,r.. ⊢ Pi: 'a
456
456
--------------------------------------------------
457
- R ⊢ for<r..> TraitId<P0..Pn>: 'a
458
-
457
+ R ⊢ for<r..> TraitId<P0..Pn>: 'a
458
+
459
459
#### Outlives for lifetimes
460
460
461
461
The outlives relation for lifetimes depends on whether the lifetime in
@@ -487,7 +487,7 @@ lifetime is not yet known. This means for example that `for<'a> fn(&'a
487
487
i32): 'x` holds, even though we do not yet know what region ` 'a` is
488
488
(and in fact it may be instantiated many times with different values
489
489
on each call to the fn).
490
-
490
+
491
491
OutlivesRegionBound:
492
492
'x ∈ R // bound region
493
493
--------------------------------------------------
@@ -525,7 +525,7 @@ but reflects the behavior of my prototype implementation.)
525
525
<> ⊢ <P0 as Trait<P1..Pn>>::Id: 'a
526
526
527
527
OutlivesProjectionTraitDef:
528
- WC = [Xi => Pi] WhereClauses(Trait)
528
+ WC = [Xi => Pi] WhereClauses(Trait)
529
529
<P0 as Trait<P1..Pn>>::Id: 'b in WC
530
530
<> ⊢ 'b: 'a
531
531
--------------------------------------------------
@@ -643,7 +643,7 @@ form:
643
643
```
644
644
C = r0: r1
645
645
| C AND C
646
- ```
646
+ ```
647
647
648
648
This is convenient because a simple fixed-point iteration suffices to
649
649
find the minimal regions which satisfy the constraints.
@@ -719,6 +719,7 @@ declare one), but we'll take those basic conditions for granted.
719
719
720
720
WfTuple:
721
721
∀i. R ⊢ Ti WF
722
+ ∀i<n. R ⊢ Ti: Sized // the *last* field may be unsized
722
723
--------------------------------------------------
723
724
R ⊢ (T0..Tn) WF
724
725
@@ -812,7 +813,7 @@ object type fragment is WF if its components are WF:
812
813
TraitId is object safe
813
814
--------------------------------------------------
814
815
R ⊢ for<r..> TraitId<P1..Pn>
815
-
816
+
816
817
Note that we don't check the where clauses declared on the trait
817
818
itself. These are checked when the object is created. The reason not
818
819
to check them here is because the ` Self ` type is not known (this is an
@@ -1024,15 +1025,15 @@ that a projection outlives `'a` if its inputs outlive `'a`. To start,
1024
1025
let's specify the projection ` <PROJ> ` as:
1025
1026
1026
1027
<P0 as Trait<P1...Pn>>::Id
1027
-
1028
+
1028
1029
where ` P ` can be a lifetime or type parameter as appropriate.
1029
-
1030
+
1030
1031
Then we know that there exists some impl of the form:
1031
1032
1032
1033
``` rust
1033
1034
impl <X0 .. Xn > Trait <Q1 .. Qn > for Q0 {
1034
1035
type Id = T ;
1035
- }
1036
+ }
1036
1037
```
1037
1038
1038
1039
Here again, ` X ` can be a lifetime or type parameter name, and ` Q ` can
@@ -1105,6 +1106,11 @@ then `R ⊢ P': 'a`. Proceed by induction and by cases over the form of `P`:
1105
1106
in a type outlive ` 'a ` , then the type outlives ` 'a ` . Follows by
1106
1107
inspection of the outlives rules.
1107
1108
1109
+ # Edit History
1110
+
1111
+ [ RFC1592] - amend to require that tuple fields be sized
1112
+
1108
1113
[ crater-errors ] : https://gist.github.com/nikomatsakis/2f851e2accfa7ba2830d#root-regressions-sorted-by-rank
1109
1114
[ crater-all ] : https://gist.github.com/nikomatsakis/364fae49de18268680f2#root-regressions-sorted-by-rank
1110
1115
[ #21953 ] : https://github.com/rust-lang/rust/issues/21953
1116
+ [ RFC1592 ] : https://github.com/rust-lang/rfcs/pull/1592
0 commit comments