mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-03 21:25:25 +00:00
Fix variance
This one does need fixpoint.
This commit is contained in:
parent
57c019a3c5
commit
547c124c05
1 changed files with 3 additions and 7 deletions
|
|
@ -57,11 +57,11 @@ pub(crate) fn variances_of(db: &dyn HirDatabase, def: GenericDefId) -> Option<Ar
|
|||
|
||||
pub(crate) fn variances_of_cycle_fn(
|
||||
_db: &dyn HirDatabase,
|
||||
result: &Option<Arc<[Variance]>>,
|
||||
_result: &Option<Arc<[Variance]>>,
|
||||
_count: u32,
|
||||
_def: GenericDefId,
|
||||
) -> CycleRecoveryAction<Option<Arc<[Variance]>>> {
|
||||
CycleRecoveryAction::Fallback(result.clone())
|
||||
CycleRecoveryAction::Iterate
|
||||
}
|
||||
|
||||
pub(crate) fn variances_of_cycle_initial(
|
||||
|
|
@ -961,16 +961,12 @@ struct S3<T>(S<T, T>);
|
|||
|
||||
#[test]
|
||||
fn prove_fixedpoint() {
|
||||
// FIXME: This is wrong, this should be `FixedPoint[T: covariant, U: covariant, V: covariant]`
|
||||
// This is a limitation of current salsa where a cycle may only set a fallback value to the
|
||||
// query result, but we need to solve a fixpoint here. The new salsa will have this
|
||||
// fortunately.
|
||||
check(
|
||||
r#"
|
||||
struct FixedPoint<T, U, V>(&'static FixedPoint<(), T, U>, V);
|
||||
"#,
|
||||
expect![[r#"
|
||||
FixedPoint[T: bivariant, U: bivariant, V: bivariant]
|
||||
FixedPoint[T: covariant, U: covariant, V: covariant]
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue