diff options
| author | varkor <github@varkor.com> | 2018-07-03 08:10:45 +0100 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2018-08-19 20:02:32 +0100 |
| commit | d8ba103334937aacd3cc821fe75894548c40e666 (patch) | |
| tree | 6d567e199ff3495f6ac0c069cd931f59b4a66b62 | |
| parent | d5e24dc121da70027c8320ab03a7ca886d16ca0e (diff) | |
| download | rust-d8ba103334937aacd3cc821fe75894548c40e666.tar.gz rust-d8ba103334937aacd3cc821fe75894548c40e666.zip | |
Fix param_idx calculation
| -rw-r--r-- | src/librustc_typeck/check/mod.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 916261eba22..c5639e9d039 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -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 { |
