diff options
| author | varkor <github@varkor.com> | 2020-01-21 20:46:21 +0000 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2020-02-22 00:27:44 +0000 |
| commit | 9939de24ac3580acfb92670f9bd568f90052340b (patch) | |
| tree | deed81b6d905c672e892fb206174b879dfb18ef0 | |
| parent | d232acdb398c5837f2c95ffe6c38970059451445 (diff) | |
| download | rust-9939de24ac3580acfb92670f9bd568f90052340b.tar.gz rust-9939de24ac3580acfb92670f9bd568f90052340b.zip | |
Correct passing of `generic_args` to `create_substs_for_generic_args`
| -rw-r--r-- | src/librustc_typeck/astconv.rs | 9 | ||||
| -rw-r--r-- | src/librustc_typeck/check/method/confirm.rs | 11 |
2 files changed, 16 insertions, 4 deletions
diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 5c9178ff66d..a1440c3e289 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -693,7 +693,14 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { self_ty.is_some(), self_ty, // Provide the generic args, and whether types should be inferred. - |_| (Some(generic_args), infer_args), + |did| { + if did == def_id { + (Some(generic_args), infer_args) + } else { + // The last component of this tuple is unimportant. + (None, false) + } + }, // Provide substitutions for parameters for which (valid) arguments have been provided. |param, arg| match (¶m.kind, arg) { (GenericParamDefKind::Lifetime, GenericArg::Lifetime(lt)) => { diff --git a/src/librustc_typeck/check/method/confirm.rs b/src/librustc_typeck/check/method/confirm.rs index 17842be9a43..04cbee8c940 100644 --- a/src/librustc_typeck/check/method/confirm.rs +++ b/src/librustc_typeck/check/method/confirm.rs @@ -314,9 +314,14 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> { false, None, // Provide the generic args, and whether types should be inferred. - |_| { - // The last argument of the returned tuple here is unimportant. - if let Some(ref data) = seg.args { (Some(data), false) } else { (None, false) } + |def_id| { + // The last component of the returned tuple here is unimportant. + if def_id == pick.item.def_id { + if let Some(ref data) = seg.args { + return (Some(data), false); + } + } + (None, false) }, // Provide substitutions for parameters for which (valid) arguments have been provided. |param, arg| match (¶m.kind, arg) { |
