Skip to content

Commit 75f4f6e

Browse files
committed
Use () for mir_keys.
1 parent 9d15abe commit 75f4f6e

File tree

5 files changed

+10
-11
lines changed

5 files changed

+10
-11
lines changed

compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ fn add_unused_functions<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>) {
265265
let ignore_unused_generics = tcx.sess.instrument_coverage_except_unused_generics();
266266

267267
let all_def_ids: DefIdSet = tcx
268-
.mir_keys(LOCAL_CRATE)
268+
.mir_keys(())
269269
.iter()
270270
.filter_map(|local_def_id| {
271271
let def_id = local_def_id.to_def_id();

compiler/rustc_metadata/src/rmeta/encoder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,7 +1237,7 @@ impl EncodeContext<'a, 'tcx> {
12371237

12381238
let mut keys_and_jobs = self
12391239
.tcx
1240-
.mir_keys(LOCAL_CRATE)
1240+
.mir_keys(())
12411241
.iter()
12421242
.filter_map(|&def_id| {
12431243
let (encode_const, encode_opt) = should_encode_mir(self.tcx, def_id);
@@ -2002,7 +2002,7 @@ fn prefetch_mir(tcx: TyCtxt<'_>) {
20022002
return;
20032003
}
20042004

2005-
par_iter(tcx.mir_keys(LOCAL_CRATE)).for_each(|&def_id| {
2005+
par_iter(tcx.mir_keys(())).for_each(|&def_id| {
20062006
let (encode_const, encode_opt) = should_encode_mir(tcx, def_id);
20072007

20082008
if encode_const {

compiler/rustc_middle/src/query/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ rustc_queries! {
223223
/// Set of all the `DefId`s in this crate that have MIR associated with
224224
/// them. This includes all the body owners, but also things like struct
225225
/// constructors.
226-
query mir_keys(_: CrateNum) -> FxHashSet<LocalDefId> {
226+
query mir_keys(_: ()) -> FxHashSet<LocalDefId> {
227227
storage(ArenaCacheSelector<'tcx>)
228228
desc { "getting a list of all mir_keys" }
229229
}

compiler/rustc_mir/src/transform/mod.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use required_consts::RequiredConstsVisitor;
33
use rustc_data_structures::fx::FxHashSet;
44
use rustc_data_structures::steal::Steal;
55
use rustc_hir as hir;
6-
use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LOCAL_CRATE};
6+
use rustc_hir::def_id::{DefId, LocalDefId};
77
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
88
use rustc_index::vec::IndexVec;
99
use rustc_middle::mir::visit::Visitor as _;
@@ -98,14 +98,13 @@ pub(crate) fn provide(providers: &mut Providers) {
9898
}
9999

100100
fn is_mir_available(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
101-
tcx.mir_keys(def_id.krate).contains(&def_id.expect_local())
101+
let def_id = def_id.expect_local();
102+
tcx.mir_keys(()).contains(&def_id)
102103
}
103104

104105
/// Finds the full set of `DefId`s within the current crate that have
105106
/// MIR associated with them.
106-
fn mir_keys(tcx: TyCtxt<'_>, krate: CrateNum) -> FxHashSet<LocalDefId> {
107-
assert_eq!(krate, LOCAL_CRATE);
108-
107+
fn mir_keys(tcx: TyCtxt<'_>, (): ()) -> FxHashSet<LocalDefId> {
109108
let mut set = FxHashSet::default();
110109

111110
// All body-owners have MIR associated with them.

compiler/rustc_mir/src/util/pretty.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use super::spanview::write_mir_fn_spanview;
1010
use crate::transform::MirSource;
1111
use either::Either;
1212
use rustc_data_structures::fx::FxHashMap;
13-
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
13+
use rustc_hir::def_id::DefId;
1414
use rustc_index::vec::Idx;
1515
use rustc_middle::mir::interpret::{
1616
read_target_uint, AllocId, Allocation, ConstValue, GlobalAlloc, Pointer,
@@ -1017,6 +1017,6 @@ pub fn dump_mir_def_ids(tcx: TyCtxt<'_>, single: Option<DefId>) -> Vec<DefId> {
10171017
if let Some(i) = single {
10181018
vec![i]
10191019
} else {
1020-
tcx.mir_keys(LOCAL_CRATE).iter().map(|def_id| def_id.to_def_id()).collect()
1020+
tcx.mir_keys(()).iter().map(|def_id| def_id.to_def_id()).collect()
10211021
}
10221022
}

0 commit comments

Comments
 (0)