Skip to content

Commit 5bf45b3

Browse files
Prevent an ICE on empty params
I still need to handle this properly, but I just threw this in to avoid the ICE. I expect I'll have several rounds with code reviewers to refine things.
1 parent 7fc8e3c commit 5bf45b3

File tree

1 file changed

+6
-2
lines changed
  • compiler/rustc_typeck/src/check/fn_ctxt

1 file changed

+6
-2
lines changed

compiler/rustc_typeck/src/check/fn_ctxt/checks.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -640,8 +640,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
640640
suggestions.push((hungry_span, "".to_string()));
641641
}
642642
Issue::Missing(arg) => {
643-
// FIXME: do this celaner, if possible. Handle `missing()`, etc
644-
let prev_span = provided_args[arg].span;
643+
// FIXME: do this cleaner, if possible. Handle `missing()`, etc
644+
let prev_span = if arg < provided_args.len() {
645+
provided_args[arg].span
646+
} else {
647+
call_span
648+
};
645649
let missing_span = Span::new(
646650
BytePos(prev_span.hi().to_u32() + 1u32),
647651
BytePos(prev_span.hi().to_u32() + 1u32),

0 commit comments

Comments
 (0)