mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Add cycle recovery for generic predicates
This commit is contained in:
parent
cf6809645e
commit
3ca40f7c08
3 changed files with 10 additions and 8 deletions
|
@ -41,6 +41,7 @@ pub trait HirDatabase: DefDatabase {
|
||||||
fn callable_item_signature(&self, def: CallableDef) -> FnSig;
|
fn callable_item_signature(&self, def: CallableDef) -> FnSig;
|
||||||
|
|
||||||
#[salsa::invoke(crate::lower::generic_predicates_for_param_query)]
|
#[salsa::invoke(crate::lower::generic_predicates_for_param_query)]
|
||||||
|
#[salsa::cycle(crate::lower::generic_predicates_for_param_recover)]
|
||||||
fn generic_predicates_for_param(
|
fn generic_predicates_for_param(
|
||||||
&self,
|
&self,
|
||||||
def: GenericDefId,
|
def: GenericDefId,
|
||||||
|
|
|
@ -532,6 +532,15 @@ pub(crate) fn generic_predicates_for_param_query(
|
||||||
.collect()
|
.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 {
|
impl TraitEnvironment {
|
||||||
pub fn lower(db: &impl HirDatabase, resolver: &Resolver) -> Arc<TraitEnvironment> {
|
pub fn lower(db: &impl HirDatabase, resolver: &Resolver) -> Arc<TraitEnvironment> {
|
||||||
let predicates = resolver
|
let predicates = resolver
|
||||||
|
|
|
@ -4718,10 +4718,6 @@ fn test() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[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() {
|
fn unselected_projection_in_trait_env_cycle_1() {
|
||||||
let t = type_at(
|
let t = type_at(
|
||||||
r#"
|
r#"
|
||||||
|
@ -4742,10 +4738,6 @@ fn test<T: Trait>() where T: Trait2<T::Item> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[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_2() {
|
fn unselected_projection_in_trait_env_cycle_2() {
|
||||||
let t = type_at(
|
let t = type_at(
|
||||||
r#"
|
r#"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue