@@ -12,7 +12,7 @@ use rustc_span::{Ident, Span, sym};
1212use crate :: LoweringContext ;
1313use crate :: diagnostics:: DelegationInfersMismatch ;
1414
15- #[ derive( Debug , Clone , Copy ) ]
15+ #[ derive( Debug , Clone , Copy , Eq , PartialEq ) ]
1616pub ( super ) enum GenericsPosition {
1717 Parent ,
1818 Child ,
@@ -155,7 +155,7 @@ impl<'hir> DelegationGenericArgsIterator<'hir> {
155155impl < ' hir > HirOrTyGenerics < ' hir > {
156156 pub ( super ) fn into_hir_generics ( & mut self , ctx : & mut LoweringContext < ' _ , ' hir > , span : Span ) {
157157 if let HirOrTyGenerics :: Ty ( ty) = self {
158- let rename_self = matches ! ( ty. pos, GenericsPosition :: Child ) ;
158+ let rename_self = ty. pos == GenericsPosition :: Child ;
159159 let params = ctx. uplift_delegation_generic_params ( span, & ty. data , rename_self) ;
160160
161161 * self = HirOrTyGenerics :: Hir ( DelegationGenerics {
@@ -218,6 +218,13 @@ impl<'hir> HirOrTyGenerics<'hir> {
218218 . expect ( "`Self` generic param is not found while expected" ) ,
219219 }
220220 }
221+
222+ pub ( crate ) fn pos ( & self ) -> GenericsPosition {
223+ match self {
224+ HirOrTyGenerics :: Ty ( ty) => ty. pos ,
225+ HirOrTyGenerics :: Hir ( hir) => hir. pos ,
226+ }
227+ }
221228}
222229
223230impl < ' hir > GenericsGenerationResult < ' hir > {
@@ -590,6 +597,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
590597 ident : p. name . ident ( ) ,
591598 infer_args : false ,
592599 res,
600+ delegation_child_segment : false ,
593601 } ] ) ,
594602 res,
595603 span : p. span ,
0 commit comments