From c524f3ca98708e994c1670e47f789d9f03c1050e Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Wed, 8 Jan 2020 05:30:23 +0900 Subject: [PATCH] Display more informative ICE --- src/librustc/ty/layout.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs index 4b7304e7c1e8d..acaa4eec9410d 100644 --- a/src/librustc/ty/layout.rs +++ b/src/librustc/ty/layout.rs @@ -2507,17 +2507,21 @@ where let extra_args = if sig.abi == RustCall { assert!(!sig.c_variadic && extra_args.is_empty()); - match sig.inputs().last().unwrap().kind { - ty::Tuple(tupled_arguments) => { + if let Some(input) = sig.inputs().last() { + if let ty::Tuple(tupled_arguments) = input.kind { inputs = &sig.inputs()[0..sig.inputs().len() - 1]; tupled_arguments.iter().map(|k| k.expect_ty()).collect() - } - _ => { + } else { bug!( "argument to function with \"rust-call\" ABI \ - is not a tuple" + is not a tuple" ); } + } else { + bug!( + "argument to function with \"rust-call\" ABI \ + is not a tuple" + ); } } else { assert!(sig.c_variadic || extra_args.is_empty());