File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ // Regression test for #71546.
2+
3+ // ignore-compare-mode-nll
4+ // NLL stderr is different from the original one.
5+
6+ pub fn serialize_as_csv < V > ( value : & V ) -> Result < String , & str >
7+ where
8+ V : ' static ,
9+ for < ' a > & ' a V : IntoIterator ,
10+ for < ' a > <& ' a V as IntoIterator >:: Item : ToString + ' static ,
11+ {
12+ let csv_str: String = value //~ ERROR: the associated type `<&'a V as IntoIterator>::Item` may not live long enough
13+ . into_iter ( )
14+ . map ( |elem| elem. to_string ( ) )
15+ . collect :: < String > ( ) ;
16+ Ok ( csv_str)
17+ }
18+
19+ 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:12: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:10: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