Skip to content

Commit

Permalink
Fix param_idx calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
varkor committed Aug 19, 2018
1 parent d5e24dc commit d8ba103
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/librustc_typeck/check/mod.rs
Expand Up @@ -4997,7 +4997,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
} else {
0
};
let param_idx = (param.index as usize - has_self as usize)
let self_offset = (defs.parent_count == 0 && has_self) as usize;
let param_idx =
(param.index as usize - defs.parent_count - self_offset as usize)
.saturating_sub(lifetime_offset);
if let Some(arg) = data.args.get(param_idx) {
match param.kind {
Expand Down

0 comments on commit d8ba103

Please sign in to comment.