Skip to content

Commit

Permalink
Move query providers.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Mar 3, 2022
1 parent 1b4b5e0 commit 6f8e9f4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
5 changes: 0 additions & 5 deletions compiler/rustc_middle/src/ty/context.rs
Expand Up @@ -2999,11 +2999,6 @@ pub fn provide(providers: &mut ty::query::Providers) {
tcx.arena.alloc(tcx.resolutions(()).glob_map.get(&id).cloned().unwrap_or_default())
};

providers.lookup_stability = |tcx, id| tcx.stability().local_stability(id.expect_local());
providers.lookup_const_stability =
|tcx, id| tcx.stability().local_const_stability(id.expect_local());
providers.lookup_deprecation_entry =
|tcx, id| tcx.stability().local_deprecation_entry(id.expect_local());
providers.extern_mod_stmt_cnum =
|tcx, id| tcx.resolutions(()).extern_crate_map.get(&id).cloned();
providers.output_filenames = |tcx, ()| &tcx.output_filenames;
Expand Down
11 changes: 10 additions & 1 deletion compiler/rustc_passes/src/stability.rs
Expand Up @@ -712,7 +712,16 @@ fn check_mod_unstable_api_usage(tcx: TyCtxt<'_>, module_def_id: LocalDefId) {
}

pub(crate) fn provide(providers: &mut Providers) {
*providers = Providers { check_mod_unstable_api_usage, stability_index, ..*providers };
*providers = Providers {
check_mod_unstable_api_usage,
stability_index,
lookup_stability: |tcx, id| tcx.stability().local_stability(id.expect_local()),
lookup_const_stability: |tcx, id| tcx.stability().local_const_stability(id.expect_local()),
lookup_deprecation_entry: |tcx, id| {
tcx.stability().local_deprecation_entry(id.expect_local())
},
..*providers
};
}

struct Checker<'tcx> {
Expand Down

0 comments on commit 6f8e9f4

Please sign in to comment.