Skip to content

Commit 676f212

Browse files
Fix variance
This one does need fixpoint.
1 parent e2d14a2 commit 676f212

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/tools/rust-analyzer/crates/hir-ty/src/variance.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ pub(crate) fn variances_of(db: &dyn HirDatabase, def: GenericDefId) -> Option<Ar
5757

5858
pub(crate) fn variances_of_cycle_fn(
5959
_db: &dyn HirDatabase,
60-
result: &Option<Arc<[Variance]>>,
60+
_result: &Option<Arc<[Variance]>>,
6161
_count: u32,
6262
_def: GenericDefId,
6363
) -> CycleRecoveryAction<Option<Arc<[Variance]>>> {
64-
CycleRecoveryAction::Fallback(result.clone())
64+
CycleRecoveryAction::Iterate
6565
}
6666

6767
pub(crate) fn variances_of_cycle_initial(
@@ -961,16 +961,12 @@ struct S3<T>(S<T, T>);
961961

962962
#[test]
963963
fn prove_fixedpoint() {
964-
// FIXME: This is wrong, this should be `FixedPoint[T: covariant, U: covariant, V: covariant]`
965-
// This is a limitation of current salsa where a cycle may only set a fallback value to the
966-
// query result, but we need to solve a fixpoint here. The new salsa will have this
967-
// fortunately.
968964
check(
969965
r#"
970966
struct FixedPoint<T, U, V>(&'static FixedPoint<(), T, U>, V);
971967
"#,
972968
expect![[r#"
973-
FixedPoint[T: bivariant, U: bivariant, V: bivariant]
969+
FixedPoint[T: covariant, U: covariant, V: covariant]
974970
"#]],
975971
);
976972
}

0 commit comments

Comments
 (0)