@@ -18,9 +18,7 @@ use tracing::{debug, instrument};
1818
1919use super :: HirTyLowerer ;
2020use crate :: errors:: SelfInTypeAlias ;
21- use crate :: hir_ty_lowering:: {
22- GenericArgCountMismatch , GenericArgCountResult , PredicateFilter , RegionInferReason ,
23- } ;
21+ use crate :: hir_ty_lowering:: { GenericArgCountMismatch , PredicateFilter , RegionInferReason } ;
2422
2523impl < ' tcx > dyn HirTyLowerer < ' tcx > + ' _ {
2624 /// Lower a trait object type from the HIR to our internal notion of a type.
@@ -38,24 +36,18 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
3836
3937 let mut user_written_bounds = Vec :: new ( ) ;
4038 let mut potential_assoc_types = Vec :: new ( ) ;
41- for trait_bound in hir_bounds. iter ( ) {
42- if let hir:: BoundPolarity :: Maybe ( _) = trait_bound . modifiers . polarity {
39+ for poly_trait_ref in hir_bounds. iter ( ) {
40+ if let hir:: BoundPolarity :: Maybe ( _) = poly_trait_ref . modifiers . polarity {
4341 continue ;
4442 }
45- if let GenericArgCountResult {
46- correct :
47- Err ( GenericArgCountMismatch { invalid_args : cur_potential_assoc_types, .. } ) ,
48- ..
49- } = self . lower_poly_trait_ref (
50- & trait_bound. trait_ref ,
51- trait_bound. span ,
52- hir:: BoundConstness :: Never ,
53- hir:: BoundPolarity :: Positive ,
43+ let result = self . lower_poly_trait_ref (
44+ poly_trait_ref,
5445 dummy_self,
5546 & mut user_written_bounds,
5647 PredicateFilter :: SelfOnly ,
57- ) {
58- potential_assoc_types. extend ( cur_potential_assoc_types) ;
48+ ) ;
49+ if let Err ( GenericArgCountMismatch { invalid_args, .. } ) = result. correct {
50+ potential_assoc_types. extend ( invalid_args) ;
5951 }
6052 }
6153
0 commit comments