diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2019-06-01 15:39:12 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2019-06-01 19:30:13 -0700 |
| commit | 31918d6eef4d5c6459fc4e16e4ddedf9d8ab698d (patch) | |
| tree | 1840d35db39dffb8a2cbcabd435496d3fa7f0beb | |
| parent | 0754c8461182252f5f86eca09845ece04b533696 (diff) | |
| download | rust-31918d6eef4d5c6459fc4e16e4ddedf9d8ab698d.tar.gz rust-31918d6eef4d5c6459fc4e16e4ddedf9d8ab698d.zip | |
review comments: use param kind type to identify impl Trait
| -rw-r--r-- | src/librustc_typeck/check/compare_method.rs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs index fb83f877ccc..b4548ac7091 100644 --- a/src/librustc_typeck/check/compare_method.rs +++ b/src/librustc_typeck/check/compare_method.rs @@ -612,10 +612,11 @@ fn compare_number_of_generics<'a, 'tcx>( .map(|p| p.span) .collect(); let impl_trait_spans: Vec<Span> = trait_item.generics.params.iter() - .filter_map(|p| if !trait_item.generics.span.overlaps(p.span) { - Some(p.span) - } else { - None + .filter_map(|p| match p.kind { + GenericParamKind::Type { + synthetic: Some(hir::SyntheticTyParamKind::ImplTrait), .. + } => Some(p.span), + _ => None, }).collect(); (Some(arg_spans), impl_trait_spans) } @@ -626,10 +627,11 @@ fn compare_number_of_generics<'a, 'tcx>( let impl_hir_id = tcx.hir().as_local_hir_id(impl_.def_id).unwrap(); let impl_item = tcx.hir().expect_impl_item(impl_hir_id); let impl_item_impl_trait_spans: Vec<Span> = impl_item.generics.params.iter() - .filter_map(|p| if !impl_item.generics.span.overlaps(p.span) { - Some(p.span) - } else { - None + .filter_map(|p| match p.kind { + GenericParamKind::Type { + synthetic: Some(hir::SyntheticTyParamKind::ImplTrait), .. + } => Some(p.span), + _ => None, }).collect(); let spans = impl_item.generics.spans(); let span = spans.primary_span(); |
