]> git.proxmox.com Git - rustc.git/blame - src/test/ui/rfc-2093-infer-outlives/regions-enum-not-wf.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / rfc-2093-infer-outlives / regions-enum-not-wf.rs
CommitLineData
0bf4aa26
XL
1// Various examples of structs whose fields are not well-formed.
2
3#![allow(dead_code)]
4
5trait Dummy<'a> {
29967ef6 6 type Out;
0bf4aa26
XL
7}
8impl<'a, T> Dummy<'a> for T
29967ef6
XL
9where
10 T: 'a,
0bf4aa26 11{
29967ef6 12 type Out = ();
0bf4aa26
XL
13}
14type RequireOutlives<'a, T> = <T as Dummy<'a>>::Out;
15
16enum Ref1<'a, T> {
29967ef6 17 Ref1Variant1(RequireOutlives<'a, T>), //~ ERROR the parameter type `T` may not live long enough
0bf4aa26
XL
18}
19
20enum Ref2<'a, T> {
21 Ref2Variant1,
22 Ref2Variant2(isize, RequireOutlives<'a, T>), //~ ERROR the parameter type `T` may not live long enough
23}
24
29967ef6
XL
25enum RefOk<'a, T: 'a> {
26 RefOkVariant1(&'a T),
0bf4aa26
XL
27}
28
29// This is now well formed. RFC 2093
30enum RefIndirect<'a, T> {
29967ef6 31 RefIndirectVariant1(isize, RefOk<'a, T>),
0bf4aa26
XL
32}
33
29967ef6
XL
34enum RefDouble<'a, 'b, T> {
35 RefDoubleVariant1(&'a RequireOutlives<'b, T>),
36 //~^ the parameter type `T` may not live long enough [E0309]
0bf4aa26
XL
37}
38
29967ef6 39fn main() {}