This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed
rustc_typeck/src/variance Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -544,7 +544,7 @@ rustc_queries! {
544544 }
545545
546546 /// Gets a map with the variance of every item; use `item_variance` instead.
547- query crate_variances(_: CrateNum ) -> ty::CrateVariancesMap<'tcx> {
547+ query crate_variances(_: () ) -> ty::CrateVariancesMap<'tcx> {
548548 storage(ArenaCacheSelector<'tcx>)
549549 desc { "computing the variances for items in this crate" }
550550 }
Original file line number Diff line number Diff line change 66use hir::Node;
77use rustc_arena::DroplessArena;
88use rustc_hir as hir;
9- use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE} ;
9+ use rustc_hir::def_id::DefId;
1010use rustc_middle::ty::query::Providers;
1111use rustc_middle::ty::{self, CrateVariancesMap, TyCtxt};
1212
@@ -30,8 +30,7 @@ pub fn provide(providers: &mut Providers) {
3030 *providers = Providers { variances_of, crate_variances, ..*providers };
3131}
3232
33- fn crate_variances(tcx: TyCtxt<'_>, crate_num: CrateNum) -> CrateVariancesMap<'_> {
34- assert_eq!(crate_num, LOCAL_CRATE);
33+ fn crate_variances(tcx: TyCtxt<'_>, (): ()) -> CrateVariancesMap<'_> {
3534 let arena = DroplessArena::default();
3635 let terms_cx = terms::determine_parameters_to_be_inferred(tcx, &arena);
3736 let constraints_cx = constraints::add_constraints_from_crate(terms_cx);
@@ -79,6 +78,6 @@ fn variances_of(tcx: TyCtxt<'_>, item_def_id: DefId) -> &[ty::Variance] {
7978
8079 // Everything else must be inferred.
8180
82- let crate_map = tcx.crate_variances(LOCAL_CRATE );
81+ let crate_map = tcx.crate_variances(() );
8382 crate_map.variances.get(&item_def_id).copied().unwrap_or(&[])
8483}
You can’t perform that action at this time.
0 commit comments