Skip to content

Commit f7e00a5

Browse files
committed
fix ICE with delay-span-bug
1 parent 0c2c241 commit f7e00a5

File tree

4 files changed

+39
-3
lines changed

4 files changed

+39
-3
lines changed

Diff for: src/librustc/infer/opaque_types/mod.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -656,10 +656,13 @@ pub fn unexpected_hidden_region_diagnostic(
656656
// error reporting, which in turn should have prevented us
657657
// from getting trying to infer the hidden type
658658
// completely.
659-
span_bug!(
659+
tcx.sess.delay_span_bug(
660660
span,
661-
"hidden type captures unexpected lifetime `{:?}` but no region inference failure",
662-
hidden_region,
661+
&format!(
662+
"hidden type captures unexpected lifetime `{:?}` \
663+
but no region inference failure",
664+
hidden_region,
665+
),
663666
);
664667
}
665668
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error: lifetime may not live long enough
2+
--> $DIR/ret-impl-trait-one.rs:12:80
3+
|
4+
LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> {
5+
| ________________________________--__--__________________________________________^
6+
| | | |
7+
| | | lifetime `'b` defined here
8+
| | lifetime `'a` defined here
9+
LL | |
10+
LL | | (a, b)
11+
LL | | }
12+
| |_^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
13+
14+
error: aborting due to previous error
15+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
2+
--> $DIR/ordinary-bounds-unrelated.rs:18:74
3+
|
4+
LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'d, 'e>
5+
| ^^^^^^^^^^^^^^^^^^
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0700`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
2+
--> $DIR/ordinary-bounds-unsuited.rs:20:62
3+
|
4+
LL | fn upper_bounds<'a, 'b>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'a, 'b>
5+
| ^^^^^^^^^^^^^^^^^^
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0700`.

0 commit comments

Comments
 (0)