1
Fork 0

Member constraints already covered all of E0482 already, so that error never occurred anymore

This commit is contained in:
Oli Scherer 2021-10-16 13:54:08 +00:00
parent 2220fafa8c
commit 4413f8c709
4 changed files with 6 additions and 65 deletions

View file

@ -1,8 +1,10 @@
#### Note: this error code is no longer emitted by the compiler.
A lifetime of a returned value does not outlive the function call.
Erroneous code example:
```compile_fail,E0482
```compile_fail,E0700
fn prefix<'a>(
words: impl Iterator<Item = &'a str>
) -> impl Iterator<Item = String> { // error!
@ -41,7 +43,7 @@ fn prefix(
A similar lifetime problem might arise when returning closures:
```compile_fail,E0482
```compile_fail,E0700
fn foo(
x: &mut Vec<i32>
) -> impl FnMut(&mut Vec<i32>) -> &[i32] { // error!