diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2020-01-03 17:56:21 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-03 17:56:21 +0900 |
| commit | 76c1454d27440dd6783bcc81b8558510a18130bf (patch) | |
| tree | 7c7d8a2b52fed8b45e1d42200629a2f96ff141a9 /src/test/debuginfo/enum-thinlto.rs | |
| parent | 7c404ce2332e72bc8e2bed8f14ab0e0e6002d2af (diff) | |
| parent | 1a4f6b85a745e9855bbad4c5fdf0806200133f1d (diff) | |
| download | rust-76c1454d27440dd6783bcc81b8558510a18130bf.tar.gz rust-76c1454d27440dd6783bcc81b8558510a18130bf.zip | |
Rollup merge of #67595 - ohadravid:impl-trait-does-not-live-long-enough, r=estebank
Suggest adding a lifetime constraint for opaque type
Fixes #67577, where code like this:
```
struct List {
data: Vec<String>,
}
impl List {
fn started_with<'a>(&'a self, prefix: &'a str) -> impl Iterator<Item=&'a str> {
self.data.iter().filter(|s| s.starts_with(prefix)).map(|s| s.as_ref())
}
}
```
will show this error:
```
Compiling playground v0.0.1 (/playground)
error[E0597]: `prefix` does not live long enough
--> src/lib.rs:6:47
|
5 | fn started_with<'a>(&'a self, prefix: &'a str) -> impl Iterator<Item=&'a str> {
| -- lifetime `'a` defined here --------------------------- opaque type requires that `prefix` is borrowed for `'a`
...
```
but without suggesting the lovely `help: you can add a constraint..`.
r? @estebank
Diffstat (limited to 'src/test/debuginfo/enum-thinlto.rs')
0 files changed, 0 insertions, 0 deletions
