Skip to content

Commit 31918d6

Browse files
committed
review comments: use param kind type to identify impl Trait
1 parent 0754c84 commit 31918d6

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/librustc_typeck/check/compare_method.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -612,10 +612,11 @@ fn compare_number_of_generics<'a, 'tcx>(
612612
.map(|p| p.span)
613613
.collect();
614614
let impl_trait_spans: Vec<Span> = trait_item.generics.params.iter()
615-
.filter_map(|p| if !trait_item.generics.span.overlaps(p.span) {
616-
Some(p.span)
617-
} else {
618-
None
615+
.filter_map(|p| match p.kind {
616+
GenericParamKind::Type {
617+
synthetic: Some(hir::SyntheticTyParamKind::ImplTrait), ..
618+
} => Some(p.span),
619+
_ => None,
619620
}).collect();
620621
(Some(arg_spans), impl_trait_spans)
621622
}
@@ -626,10 +627,11 @@ fn compare_number_of_generics<'a, 'tcx>(
626627
let impl_hir_id = tcx.hir().as_local_hir_id(impl_.def_id).unwrap();
627628
let impl_item = tcx.hir().expect_impl_item(impl_hir_id);
628629
let impl_item_impl_trait_spans: Vec<Span> = impl_item.generics.params.iter()
629-
.filter_map(|p| if !impl_item.generics.span.overlaps(p.span) {
630-
Some(p.span)
631-
} else {
632-
None
630+
.filter_map(|p| match p.kind {
631+
GenericParamKind::Type {
632+
synthetic: Some(hir::SyntheticTyParamKind::ImplTrait), ..
633+
} => Some(p.span),
634+
_ => None,
633635
}).collect();
634636
let spans = impl_item.generics.spans();
635637
let span = spans.primary_span();

0 commit comments

Comments
 (0)