Skip to content

Commit d8ba103

Browse files
committed
Fix param_idx calculation
1 parent d5e24dc commit d8ba103

File tree

1 file changed

+3
-1
lines changed
  • src/librustc_typeck/check

1 file changed

+3
-1
lines changed

src/librustc_typeck/check/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4997,7 +4997,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
49974997
} else {
49984998
0
49994999
};
5000-
let param_idx = (param.index as usize - has_self as usize)
5000+
let self_offset = (defs.parent_count == 0 && has_self) as usize;
5001+
let param_idx =
5002+
(param.index as usize - defs.parent_count - self_offset as usize)
50015003
.saturating_sub(lifetime_offset);
50025004
if let Some(arg) = data.args.get(param_idx) {
50035005
match param.kind {

0 commit comments

Comments
 (0)