Skip to content

Commit ea9a03d

Browse files
authored
Rollup merge of #67986 - JohnTitor:fix-ice-rust-call, r=varkor
Display more informative ICE Fixes #66696
2 parents 0b3ef24 + c524f3c commit ea9a03d

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/librustc/ty/layout.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -2507,17 +2507,21 @@ where
25072507
let extra_args = if sig.abi == RustCall {
25082508
assert!(!sig.c_variadic && extra_args.is_empty());
25092509

2510-
match sig.inputs().last().unwrap().kind {
2511-
ty::Tuple(tupled_arguments) => {
2510+
if let Some(input) = sig.inputs().last() {
2511+
if let ty::Tuple(tupled_arguments) = input.kind {
25122512
inputs = &sig.inputs()[0..sig.inputs().len() - 1];
25132513
tupled_arguments.iter().map(|k| k.expect_ty()).collect()
2514-
}
2515-
_ => {
2514+
} else {
25162515
bug!(
25172516
"argument to function with \"rust-call\" ABI \
2518-
is not a tuple"
2517+
is not a tuple"
25192518
);
25202519
}
2520+
} else {
2521+
bug!(
2522+
"argument to function with \"rust-call\" ABI \
2523+
is not a tuple"
2524+
);
25212525
}
25222526
} else {
25232527
assert!(sig.c_variadic || extra_args.is_empty());

0 commit comments

Comments
 (0)