diff options
| author | Mark Rousskov <mark.simulacrum@gmail.com> | 2018-11-08 18:14:51 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-11-08 18:14:51 -0700 |
| commit | 4805a97274bd8673bbe01d82ab3694441b1cf11d (patch) | |
| tree | 15c7e84379ba708dcb87b2ba05ba7992466f1ba8 /src/librustc | |
| parent | 78cab361394c6cdb9ab950ff094bcc5e0635ce86 (diff) | |
| parent | cc33aecb683b1cb08bd60ba1f24ef797827fda94 (diff) | |
| download | rust-4805a97274bd8673bbe01d82ab3694441b1cf11d.tar.gz rust-4805a97274bd8673bbe01d82ab3694441b1cf11d.zip | |
Rollup merge of #55638 - pnkfelix:issue-55608-ice-reempty-msg_span_from_free_region, r=estebank
Fix ICE in msg_span_from_free_region on ReEmpty
On an example like this:
```rust
#![feature(conservative_impl_trait)]
fn server() -> impl FilterBase2 {
segment2(|| { loop { } }).map2(|| "")
}
trait FilterBase2 {
fn map2<F>(self, _fn: F) -> Map2<F> where Self: Sized { loop { } }
}
struct Map2<F> { _func: F }
impl<F> FilterBase2 for Map2<F> { }
fn segment2<F>(_fn: F) -> Map2<F> where F: Fn() -> Result<(), ()> {
loop { }
}
```
we now, instead of ICE'ing, get a diagnostic like:
```
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> issue-55608.rs:3:16
|
3 | fn server() -> impl FilterBase2 {
| ^^^^^^^^^^^^^^^^
|
= note: hidden type `Map2<[closure@issue-55608.rs:4:36: 4:41]>` captures an empty lifetime
```
Fix #55608
Diffstat (limited to 'src/librustc')
| -rw-r--r-- | src/librustc/infer/error_reporting/mod.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs index 1963d366e7a..f833ebc7ca7 100644 --- a/src/librustc/infer/error_reporting/mod.rs +++ b/src/librustc/infer/error_reporting/mod.rs @@ -178,6 +178,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { self.msg_span_from_early_bound_and_free_regions(region) } ty::ReStatic => ("the static lifetime".to_owned(), None), + ty::ReEmpty => ("an empty lifetime".to_owned(), None), _ => bug!("{:?}", region), } } |
