diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-01-09 00:22:13 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-09 00:22:13 +0100 |
| commit | ea9a03dbb8bed267afb42923eda0a725d4d6107d (patch) | |
| tree | fcc952eb6a07b0eb05dd98fa875b67631bc66822 | |
| parent | 0b3ef24e7596a522a13a3d2c385567d3592b4dfa (diff) | |
| parent | c524f3ca98708e994c1670e47f789d9f03c1050e (diff) | |
Rollup merge of #67986 - JohnTitor:fix-ice-rust-call, r=varkor
Display more informative ICE Fixes #66696
| -rw-r--r-- | src/librustc/ty/layout.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs index 4b7304e7c1e..acaa4eec941 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()); |
