fix ICE with delay-span-bug

This commit is contained in:
Niko Matsakis 2019-07-02 14:23:38 -04:00
parent 0c2c2416bf
commit f7e00a55bb
4 changed files with 39 additions and 3 deletions

View File

@ -656,10 +656,13 @@ pub fn unexpected_hidden_region_diagnostic(
// error reporting, which in turn should have prevented us
// from getting trying to infer the hidden type
// completely.
span_bug!(
tcx.sess.delay_span_bug(
span,
"hidden type captures unexpected lifetime `{:?}` but no region inference failure",
hidden_region,
&format!(
"hidden type captures unexpected lifetime `{:?}` \
but no region inference failure",
hidden_region,
),
);
}
}

View File

@ -0,0 +1,15 @@
error: lifetime may not live long enough
--> $DIR/ret-impl-trait-one.rs:12:80
|
LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> {
| ________________________________--__--__________________________________________^
| | | |
| | | lifetime `'b` defined here
| | lifetime `'a` defined here
LL | |
LL | | (a, b)
LL | | }
| |_^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
error: aborting due to previous error

View File

@ -0,0 +1,9 @@
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ordinary-bounds-unrelated.rs:18:74
|
LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'d, 'e>
| ^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0700`.

View File

@ -0,0 +1,9 @@
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ordinary-bounds-unsuited.rs:20:62
|
LL | fn upper_bounds<'a, 'b>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'a, 'b>
| ^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0700`.