Add cycle recovery for generic predicates

This commit is contained in:
Florian Diebold 2019-11-30 12:39:21 +01:00
parent cf6809645e
commit 3ca40f7c08
3 changed files with 10 additions and 8 deletions

View File

@ -41,6 +41,7 @@ pub trait HirDatabase: DefDatabase {
fn callable_item_signature(&self, def: CallableDef) -> FnSig;
#[salsa::invoke(crate::lower::generic_predicates_for_param_query)]
#[salsa::cycle(crate::lower::generic_predicates_for_param_recover)]
fn generic_predicates_for_param(
&self,
def: GenericDefId,

View File

@ -532,6 +532,15 @@ pub(crate) fn generic_predicates_for_param_query(
.collect()
}
pub(crate) fn generic_predicates_for_param_recover(
_db: &impl HirDatabase,
_cycle: &[String],
_def: &GenericDefId,
_param_idx: &u32,
) -> Arc<[GenericPredicate]> {
Arc::new([])
}
impl TraitEnvironment {
pub fn lower(db: &impl HirDatabase, resolver: &Resolver) -> Arc<TraitEnvironment> {
let predicates = resolver

View File

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