@@ -176,13 +176,22 @@ pub(super) fn associated_type_by_name_including_super_traits(
176
176
pub ( crate ) fn generics ( db : & dyn DefDatabase , def : GenericDefId ) -> Generics {
177
177
let parent_generics = parent_generic_def ( db, def) . map ( |def| Box :: new ( generics ( db, def) ) ) ;
178
178
if parent_generics. is_some ( ) && matches ! ( def, GenericDefId :: TypeAliasId ( _) ) {
179
- // XXX: treat generic associated types as not existing to avoid crashes (#)
180
- //
181
- // Chalk expects the inner associated type's parameters to come
182
- // *before*, not after the trait's generics as we've always done it.
183
- // Adapting to this requires a larger refactoring
184
- cov_mark:: hit!( ignore_gats) ;
185
- return Generics { def, params : Interned :: new ( Default :: default ( ) ) , parent_generics } ;
179
+ let params = db. generic_params ( def) ;
180
+ if params
181
+ . type_or_consts
182
+ . iter ( )
183
+ . any ( |( _, x) | matches ! ( x, TypeOrConstParamData :: ConstParamData ( _) ) )
184
+ {
185
+ // XXX: treat const generic associated types as not existing to avoid crashes (#11769)
186
+ //
187
+ // Chalk expects the inner associated type's parameters to come
188
+ // *before*, not after the trait's generics as we've always done it.
189
+ // Adapting to this requires a larger refactoring
190
+ cov_mark:: hit!( ignore_gats) ;
191
+ return Generics { def, params : Interned :: new ( Default :: default ( ) ) , parent_generics } ;
192
+ } else {
193
+ Generics { def, params, parent_generics }
194
+ }
186
195
}
187
196
Generics { def, params : db. generic_params ( def) , parent_generics }
188
197
}
0 commit comments