about summary refs log tree commit diff
path: root/src/test/debuginfo/enum-thinlto.rs
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-01-03 17:56:21 +0900
committerGitHub <noreply@github.com>2020-01-03 17:56:21 +0900
commit76c1454d27440dd6783bcc81b8558510a18130bf (patch)
tree7c7d8a2b52fed8b45e1d42200629a2f96ff141a9 /src/test/debuginfo/enum-thinlto.rs
parent7c404ce2332e72bc8e2bed8f14ab0e0e6002d2af (diff)
parent1a4f6b85a745e9855bbad4c5fdf0806200133f1d (diff)
downloadrust-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