Skip to content

Commit

Permalink
Rollup merge of #67986 - JohnTitor:fix-ice-rust-call, r=varkor
Browse files Browse the repository at this point in the history
Display more informative ICE

Fixes #66696
  • Loading branch information
Centril authored Jan 8, 2020
2 parents 0b3ef24 + c524f3c commit ea9a03d
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/librustc/ty/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit ea9a03d

Please sign in to comment.