File tree 2 files changed +57
-0
lines changed
2 files changed +57
-0
lines changed Original file line number Diff line number Diff line change
1
+ error[E0759]: `fn` parameter has lifetime `'x` but it needs to satisfy a `'static` lifetime requirement
2
+ --> $DIR/normalization-nested.rs:35:20
3
+ |
4
+ LL | pub fn test<'x>(_: Map<Vec<&'x ()>>, s: &'x str) -> &'static str {
5
+ | ^^^^^^^^^^^^^^^^
6
+ | |
7
+ | this data with lifetime `'x`...
8
+ | ...is used and required to live as long as `'static` here
9
+ |
10
+ note: `'static` lifetime requirement introduced by this bound
11
+ --> $DIR/normalization-nested.rs:33:14
12
+ |
13
+ LL | I::Item: 'static;
14
+ | ^^^^^^^
15
+
16
+ error: aborting due to previous error
17
+
18
+ For more information about this error, try `rustc --explain E0759`.
Original file line number Diff line number Diff line change
1
+ // Test for normalization of projections that appear in the item bounds
2
+ // (versus those that appear directly in the input types).
3
+ // Both revisions should pass. `lifetime` revision is a bug.
4
+ //
5
+ // revisions: param_ty lifetime
6
+ // [param_ty] check-pass
7
+ // [lifetime] check-fail
8
+ // [lifetime] known-bug: #109799
9
+
10
+ pub trait Iter {
11
+ type Item ;
12
+ }
13
+
14
+ #[ cfg( param_ty) ]
15
+ impl < X , I > Iter for I
16
+ where
17
+ I : IntoIterator < Item = X > ,
18
+ {
19
+ type Item = X ;
20
+ }
21
+
22
+ #[ cfg( lifetime) ]
23
+ impl < ' x , I > Iter for I
24
+ where
25
+ I : IntoIterator < Item = & ' x ( ) > ,
26
+ {
27
+ type Item = & ' x ( ) ;
28
+ }
29
+
30
+ pub struct Map < I > ( I )
31
+ where
32
+ I : Iter ,
33
+ I :: Item : ' static ;
34
+
35
+ pub fn test < ' x > ( _: Map < Vec < & ' x ( ) > > , s : & ' x str ) -> & ' static str {
36
+ s
37
+ }
38
+
39
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments