mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
fix: Paper over GAT panic
TIL that Chalk expects the arguments to a generic associated type to come *before* the ones for the parent trait, not *after* as we have been doing with all other nested generics. Fixing this requires a larger refactoring, so for now this just papers over the problem by completely ignoring parameters of associated types. Fixes #11769.
This commit is contained in:
parent
63c4d6b20d
commit
019f48673a
2 changed files with 28 additions and 0 deletions
|
@ -175,6 +175,15 @@ pub(super) fn associated_type_by_name_including_super_traits(
|
|||
|
||||
pub(crate) fn generics(db: &dyn DefDatabase, def: GenericDefId) -> Generics {
|
||||
let parent_generics = parent_generic_def(db, def).map(|def| Box::new(generics(db, def)));
|
||||
if parent_generics.is_some() && matches!(def, GenericDefId::TypeAliasId(_)) {
|
||||
// XXX: treat generic associated types as not existing to avoid crashes (#)
|
||||
//
|
||||
// Chalk expects the inner associated type's parameters to come
|
||||
// *before*, not after the trait's generics as we've always done it.
|
||||
// Adapting to this requires a larger refactoring
|
||||
cov_mark::hit!(ignore_gats);
|
||||
return Generics { def, params: Interned::new(Default::default()), parent_generics };
|
||||
}
|
||||
Generics { def, params: db.generic_params(def), parent_generics }
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue