-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #97580 - JohnTitor:issue-71546, r=compiler-errors
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Regression test for #71546. | ||
|
||
// ignore-compare-mode-nll | ||
// NLL stderr is different from the original one. | ||
|
||
pub fn serialize_as_csv<V>(value: &V) -> Result<String, &str> | ||
where | ||
V: 'static, | ||
for<'a> &'a V: IntoIterator, | ||
for<'a> <&'a V as IntoIterator>::Item: ToString + 'static, | ||
{ | ||
let csv_str: String = value //~ ERROR: the associated type `<&'a V as IntoIterator>::Item` may not live long enough | ||
.into_iter() | ||
.map(|elem| elem.to_string()) | ||
.collect::<String>(); | ||
Ok(csv_str) | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
error[E0310]: the associated type `<&'a V as IntoIterator>::Item` may not live long enough | ||
--> $DIR/issue-71546.rs:12:27 | ||
| | ||
LL | let csv_str: String = value | ||
| ___________________________^ | ||
LL | | .into_iter() | ||
LL | | .map(|elem| elem.to_string()) | ||
| |_____________________________________^ | ||
| | ||
= help: consider adding an explicit lifetime bound `<&'a V as IntoIterator>::Item: 'static`... | ||
= note: ...so that the type `<&'a V as IntoIterator>::Item` will meet its required lifetime bounds... | ||
note: ...that is required by this bound | ||
--> $DIR/issue-71546.rs:10:55 | ||
| | ||
LL | for<'a> <&'a V as IntoIterator>::Item: ToString + 'static, | ||
| ^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0310`. |