Skip to content

Commit 3ca40f7

Browse files
committed
Add cycle recovery for generic predicates
1 parent cf68096 commit 3ca40f7

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

crates/ra_hir_ty/src/db.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ pub trait HirDatabase: DefDatabase {
4141
fn callable_item_signature(&self, def: CallableDef) -> FnSig;
4242

4343
#[salsa::invoke(crate::lower::generic_predicates_for_param_query)]
44+
#[salsa::cycle(crate::lower::generic_predicates_for_param_recover)]
4445
fn generic_predicates_for_param(
4546
&self,
4647
def: GenericDefId,

crates/ra_hir_ty/src/lower.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,15 @@ pub(crate) fn generic_predicates_for_param_query(
532532
.collect()
533533
}
534534

535+
pub(crate) fn generic_predicates_for_param_recover(
536+
_db: &impl HirDatabase,
537+
_cycle: &[String],
538+
_def: &GenericDefId,
539+
_param_idx: &u32,
540+
) -> Arc<[GenericPredicate]> {
541+
Arc::new([])
542+
}
543+
535544
impl TraitEnvironment {
536545
pub fn lower(db: &impl HirDatabase, resolver: &Resolver) -> Arc<TraitEnvironment> {
537546
let predicates = resolver

crates/ra_hir_ty/src/tests.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4718,10 +4718,6 @@ fn test() {
47184718
}
47194719

47204720
#[test]
4721-
// FIXME this is currently a Salsa panic; it would be nicer if it just returned
4722-
// in Unknown, and we should be able to do that once Salsa allows us to handle
4723-
// the cycle. But at least it doesn't overflow for now.
4724-
#[should_panic]
47254721
fn unselected_projection_in_trait_env_cycle_1() {
47264722
let t = type_at(
47274723
r#"
@@ -4742,10 +4738,6 @@ fn test<T: Trait>() where T: Trait2<T::Item> {
47424738
}
47434739

47444740
#[test]
4745-
// FIXME this is currently a Salsa panic; it would be nicer if it just returned
4746-
// in Unknown, and we should be able to do that once Salsa allows us to handle
4747-
// the cycle. But at least it doesn't overflow for now.
4748-
#[should_panic]
47494741
fn unselected_projection_in_trait_env_cycle_2() {
47504742
let t = type_at(
47514743
r#"

0 commit comments

Comments
 (0)