Rollup merge of #125054 - nnethercote:fix-124973, r=compiler-errors
Handle `ReVar` in `note_and_explain_region` PR #124918 made this path abort. The added test, from fuzzing, identified that it is reachable. r? `@lcnr`
This commit is contained in:
commit
72fd85c617
@ -173,7 +173,10 @@ pub(super) fn note_and_explain_region<'tcx>(
|
|||||||
|
|
||||||
ty::ReError(_) => return,
|
ty::ReError(_) => return,
|
||||||
|
|
||||||
ty::ReVar(_) | ty::ReBound(..) | ty::ReErased => {
|
// FIXME(#125431): `ReVar` shouldn't reach here.
|
||||||
|
ty::ReVar(_) => (format!("lifetime `{region}`"), alt_span),
|
||||||
|
|
||||||
|
ty::ReBound(..) | ty::ReErased => {
|
||||||
bug!("unexpected region for note_and_explain_region: {:?}", region);
|
bug!("unexpected region for note_and_explain_region: {:?}", region);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
8
tests/ui/inference/note-and-explain-ReVar-124973.rs
Normal file
8
tests/ui/inference/note-and-explain-ReVar-124973.rs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
//@ edition:2018
|
||||||
|
|
||||||
|
#![feature(c_variadic)]
|
||||||
|
|
||||||
|
async unsafe extern "C" fn multiple_named_lifetimes<'a, 'b>(_: u8, ...) {}
|
||||||
|
//~^ ERROR hidden type for `impl Future<Output = ()>` captures lifetime that does not appear in bounds
|
||||||
|
|
||||||
|
fn main() {}
|
13
tests/ui/inference/note-and-explain-ReVar-124973.stderr
Normal file
13
tests/ui/inference/note-and-explain-ReVar-124973.stderr
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
error[E0700]: hidden type for `impl Future<Output = ()>` captures lifetime that does not appear in bounds
|
||||||
|
--> $DIR/note-and-explain-ReVar-124973.rs:5:73
|
||||||
|
|
|
||||||
|
LL | async unsafe extern "C" fn multiple_named_lifetimes<'a, 'b>(_: u8, ...) {}
|
||||||
|
| ----------------------------------------------------------------------- ^^
|
||||||
|
| |
|
||||||
|
| opaque type defined here
|
||||||
|
|
|
||||||
|
= note: hidden type `{async fn body of multiple_named_lifetimes<'a, 'b>()}` captures lifetime `'_`
|
||||||
|
|
||||||
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0700`.
|
Loading…
Reference in New Issue
Block a user