aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty')
-rw-r--r--crates/hir_ty/src/db.rs1
-rw-r--r--crates/hir_ty/src/lower.rs21
2 files changed, 22 insertions, 0 deletions
diff --git a/crates/hir_ty/src/db.rs b/crates/hir_ty/src/db.rs
index cf67d4266..9da0a02e3 100644
--- a/crates/hir_ty/src/db.rs
+++ b/crates/hir_ty/src/db.rs
@@ -70,6 +70,7 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
70 fn trait_environment(&self, def: GenericDefId) -> Arc<crate::TraitEnvironment>; 70 fn trait_environment(&self, def: GenericDefId) -> Arc<crate::TraitEnvironment>;
71 71
72 #[salsa::invoke(crate::lower::generic_defaults_query)] 72 #[salsa::invoke(crate::lower::generic_defaults_query)]
73 #[salsa::cycle(crate::lower::generic_defaults_recover)]
73 fn generic_defaults(&self, def: GenericDefId) -> Arc<[Binders<Ty>]>; 74 fn generic_defaults(&self, def: GenericDefId) -> Arc<[Binders<Ty>]>;
74 75
75 #[salsa::invoke(InherentImpls::inherent_impls_in_crate_query)] 76 #[salsa::invoke(InherentImpls::inherent_impls_in_crate_query)]
diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs
index 7fd46becd..d01933e6b 100644
--- a/crates/hir_ty/src/lower.rs
+++ b/crates/hir_ty/src/lower.rs
@@ -1089,6 +1089,27 @@ pub(crate) fn generic_defaults_query(
1089 defaults 1089 defaults
1090} 1090}
1091 1091
1092pub(crate) fn generic_defaults_recover(
1093 db: &dyn HirDatabase,
1094 _cycle: &[String],
1095 def: &GenericDefId,
1096) -> Arc<[Binders<Ty>]> {
1097 let generic_params = generics(db.upcast(), *def);
1098
1099 // we still need one default per parameter
1100 let defaults = generic_params
1101 .iter()
1102 .enumerate()
1103 .map(|(idx, _)| {
1104 let ty = TyKind::Error.intern(&Interner);
1105
1106 crate::make_only_type_binders(idx, ty)
1107 })
1108 .collect();
1109
1110 defaults
1111}
1112
1092fn fn_sig_for_fn(db: &dyn HirDatabase, def: FunctionId) -> PolyFnSig { 1113fn fn_sig_for_fn(db: &dyn HirDatabase, def: FunctionId) -> PolyFnSig {
1093 let data = db.function_data(def); 1114 let data = db.function_data(def);
1094 let resolver = def.resolver(db.upcast()); 1115 let resolver = def.resolver(db.upcast());