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! {
544
544
}
545
545
546
546
/// 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> {
548
548
storage( ArenaCacheSelector <' tcx>)
549
549
desc { "computing the variances for items in this crate" }
550
550
}
Original file line number Diff line number Diff line change 6
6
use hir:: Node ;
7
7
use rustc_arena:: DroplessArena ;
8
8
use rustc_hir as hir;
9
- use rustc_hir:: def_id:: { CrateNum , DefId , LOCAL_CRATE } ;
9
+ use rustc_hir:: def_id:: DefId ;
10
10
use rustc_middle:: ty:: query:: Providers ;
11
11
use rustc_middle:: ty:: { self , CrateVariancesMap , TyCtxt } ;
12
12
@@ -30,8 +30,7 @@ pub fn provide(providers: &mut Providers) {
30
30
* providers = Providers { variances_of, crate_variances, ..* providers } ;
31
31
}
32
32
33
- fn crate_variances ( tcx : TyCtxt < ' _ > , crate_num : CrateNum ) -> CrateVariancesMap < ' _ > {
34
- assert_eq ! ( crate_num, LOCAL_CRATE ) ;
33
+ fn crate_variances ( tcx : TyCtxt < ' _ > , ( ) : ( ) ) -> CrateVariancesMap < ' _ > {
35
34
let arena = DroplessArena :: default ( ) ;
36
35
let terms_cx = terms:: determine_parameters_to_be_inferred ( tcx, & arena) ;
37
36
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] {
79
78
80
79
// Everything else must be inferred.
81
80
82
- let crate_map = tcx. crate_variances ( LOCAL_CRATE ) ;
81
+ let crate_map = tcx. crate_variances ( ( ) ) ;
83
82
crate_map. variances . get ( & item_def_id) . copied ( ) . unwrap_or ( & [ ] )
84
83
}
You can’t perform that action at this time.
0 commit comments