File tree 2 files changed +36
-0
lines changed
2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Regression test for #71546.
2
+
3
+ pub fn serialize_as_csv < V > ( value : & V ) -> Result < String , & str >
4
+ where
5
+ V : ' static ,
6
+ for < ' a > & ' a V : IntoIterator ,
7
+ for < ' a > <& ' a V as IntoIterator >:: Item : ToString + ' static ,
8
+ {
9
+ let csv_str: String = value //~ ERROR: the associated type `<&'a V as IntoIterator>::Item` may not live long enough
10
+ . into_iter ( )
11
+ . map ( |elem| elem. to_string ( ) )
12
+ . collect :: < String > ( ) ;
13
+ Ok ( csv_str)
14
+ }
15
+
16
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0310]: the associated type `<&'a V as IntoIterator>::Item` may not live long enough
2
+ --> $DIR/issue-71546.rs:9:27
3
+ |
4
+ LL | let csv_str: String = value
5
+ | ___________________________^
6
+ LL | | .into_iter()
7
+ LL | | .map(|elem| elem.to_string())
8
+ | |_____________________________________^
9
+ |
10
+ = help: consider adding an explicit lifetime bound `<&'a V as IntoIterator>::Item: 'static`...
11
+ = note: ...so that the type `<&'a V as IntoIterator>::Item` will meet its required lifetime bounds...
12
+ note: ...that is required by this bound
13
+ --> $DIR/issue-71546.rs:7:55
14
+ |
15
+ LL | for<'a> <&'a V as IntoIterator>::Item: ToString + 'static,
16
+ | ^^^^^^^
17
+
18
+ error: aborting due to previous error
19
+
20
+ For more information about this error, try `rustc --explain E0310`.
You can’t perform that action at this time.
0 commit comments