Skip to content

Commit a4ab375

Browse files
committed
Fix #124973.
PR #124918 made this path abort. The added test, from fuzzing, identified that it is reachable.
1 parent 852a78e commit a4ab375

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

compiler/rustc_infer/src/infer/error_reporting/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,9 @@ pub(super) fn note_and_explain_region<'tcx>(
172172

173173
ty::ReError(_) => return,
174174

175-
ty::ReVar(_) | ty::ReBound(..) | ty::ReErased => {
175+
ty::ReVar(_) => (format!("lifetime `{region}`"), alt_span),
176+
177+
ty::ReBound(..) | ty::ReErased => {
176178
bug!("unexpected region for note_and_explain_region: {:?}", region);
177179
}
178180
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//@ edition:2018
2+
3+
#![feature(c_variadic)]
4+
5+
async unsafe extern "C" fn multiple_named_lifetimes<'a, 'b>(_: u8, ...) {}
6+
//~^ ERROR hidden type for `impl Future<Output = ()>` captures lifetime that does not appear in bounds
7+
8+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
error[E0700]: hidden type for `impl Future<Output = ()>` captures lifetime that does not appear in bounds
2+
--> $DIR/note-and-explain-ReVar-124973.rs:5:73
3+
|
4+
LL | async unsafe extern "C" fn multiple_named_lifetimes<'a, 'b>(_: u8, ...) {}
5+
| ----------------------------------------------------------------------- ^^
6+
| |
7+
| opaque type defined here
8+
|
9+
= note: hidden type `{async fn body of multiple_named_lifetimes<'a, 'b>()}` captures lifetime `'_`
10+
11+
error: aborting due to 1 previous error
12+
13+
For more information about this error, try `rustc --explain E0700`.

0 commit comments

Comments
 (0)