Merge collect_mod_item_types query into check_well_formed

This commit is contained in:
Oli Scherer
2024-02-23 11:45:44 +00:00
parent 42ab88d747
commit ae50e36dfa
67 changed files with 1116 additions and 1187 deletions

View File

@@ -131,6 +131,27 @@ impl<'tcx> Value<TyCtxt<'tcx>> for ty::EarlyBinder<ty::Binder<'_, ty::FnSig<'_>>
}
}
impl<'tcx> Value<TyCtxt<'tcx>> for &[ty::Variance] {
fn from_cycle_error(
tcx: TyCtxt<'tcx>,
cycle_error: &CycleError,
_guar: ErrorGuaranteed,
) -> Self {
if let Some(frame) = cycle_error.cycle.get(0)
&& frame.query.dep_kind == dep_kinds::variances_of
&& let Some(def_id) = frame.query.def_id
{
let n = tcx.generics_of(def_id).params.len();
vec![ty::Variance::Bivariant; n].leak()
} else {
span_bug!(
cycle_error.usage.as_ref().unwrap().0,
"only `variances_of` returns `&[ty::Variance]`"
);
}
}
}
// Take a cycle of `Q` and try `try_cycle` on every permutation, falling back to `otherwise`.
fn search_for_cycle_permutation<Q, T>(
cycle: &[Q],