From 63422f3fc0033b79a84aeb4dd0f60d43a853d42f Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Mon, 6 Jan 2025 16:04:53 +0100 Subject: [PATCH] Use `supposely_unreachable!` to get better errors --- frontend/exporter/src/types/mir.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/frontend/exporter/src/types/mir.rs b/frontend/exporter/src/types/mir.rs index c05438ce2..ffc2535c2 100644 --- a/frontend/exporter/src/types/mir.rs +++ b/frontend/exporter/src/types/mir.rs @@ -436,7 +436,11 @@ fn translate_terminator_kind_call<'tcx, S: BaseState<'tcx> + HasMir<'tcx> + HasO let sig = match hax_ty.kind() { TyKind::Arrow(sig) => sig, TyKind::Closure(_, args) => &args.untupled_sig, - _ => unreachable!("Attempting to call non-function type: {ty:?}"), + _ => supposely_unreachable_fatal!( + s, + "TerminatorKind_Call_expected_fn_type"; + { ty } + ), }; let fun_op = if let ty::TyKind::FnDef(def_id, generics) = ty.kind() { // The type of the value is one of the singleton types that corresponds to each function, @@ -471,11 +475,12 @@ fn translate_terminator_kind_call<'tcx, S: BaseState<'tcx> + HasMir<'tcx> + HasO .iter() .map(|var| match var { BoundVariableKind::Region(r) => r, - BoundVariableKind::Ty(..) => { - unreachable!("Found late-bound type variable") - } - BoundVariableKind::Const => { - unreachable!("Found late-bound const variable") + BoundVariableKind::Ty(..) | BoundVariableKind::Const => { + supposely_unreachable_fatal!( + s, + "non_lifetime_late_bound"; + { var } + ) } }) .map(|_| {