mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 16:54:01 +00:00
Use () for mir_keys.
This commit is contained in:
parent
9d15abe0cc
commit
75f4f6ee4f
@ -265,7 +265,7 @@ fn add_unused_functions<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>) {
|
||||
let ignore_unused_generics = tcx.sess.instrument_coverage_except_unused_generics();
|
||||
|
||||
let all_def_ids: DefIdSet = tcx
|
||||
.mir_keys(LOCAL_CRATE)
|
||||
.mir_keys(())
|
||||
.iter()
|
||||
.filter_map(|local_def_id| {
|
||||
let def_id = local_def_id.to_def_id();
|
||||
|
@ -1237,7 +1237,7 @@ impl EncodeContext<'a, 'tcx> {
|
||||
|
||||
let mut keys_and_jobs = self
|
||||
.tcx
|
||||
.mir_keys(LOCAL_CRATE)
|
||||
.mir_keys(())
|
||||
.iter()
|
||||
.filter_map(|&def_id| {
|
||||
let (encode_const, encode_opt) = should_encode_mir(self.tcx, def_id);
|
||||
@ -2002,7 +2002,7 @@ fn prefetch_mir(tcx: TyCtxt<'_>) {
|
||||
return;
|
||||
}
|
||||
|
||||
par_iter(tcx.mir_keys(LOCAL_CRATE)).for_each(|&def_id| {
|
||||
par_iter(tcx.mir_keys(())).for_each(|&def_id| {
|
||||
let (encode_const, encode_opt) = should_encode_mir(tcx, def_id);
|
||||
|
||||
if encode_const {
|
||||
|
@ -223,7 +223,7 @@ rustc_queries! {
|
||||
/// Set of all the `DefId`s in this crate that have MIR associated with
|
||||
/// them. This includes all the body owners, but also things like struct
|
||||
/// constructors.
|
||||
query mir_keys(_: CrateNum) -> FxHashSet<LocalDefId> {
|
||||
query mir_keys(_: ()) -> FxHashSet<LocalDefId> {
|
||||
storage(ArenaCacheSelector<'tcx>)
|
||||
desc { "getting a list of all mir_keys" }
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ use required_consts::RequiredConstsVisitor;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_data_structures::steal::Steal;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LOCAL_CRATE};
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc_index::vec::IndexVec;
|
||||
use rustc_middle::mir::visit::Visitor as _;
|
||||
@ -98,14 +98,13 @@ pub(crate) fn provide(providers: &mut Providers) {
|
||||
}
|
||||
|
||||
fn is_mir_available(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
|
||||
tcx.mir_keys(def_id.krate).contains(&def_id.expect_local())
|
||||
let def_id = def_id.expect_local();
|
||||
tcx.mir_keys(()).contains(&def_id)
|
||||
}
|
||||
|
||||
/// Finds the full set of `DefId`s within the current crate that have
|
||||
/// MIR associated with them.
|
||||
fn mir_keys(tcx: TyCtxt<'_>, krate: CrateNum) -> FxHashSet<LocalDefId> {
|
||||
assert_eq!(krate, LOCAL_CRATE);
|
||||
|
||||
fn mir_keys(tcx: TyCtxt<'_>, (): ()) -> FxHashSet<LocalDefId> {
|
||||
let mut set = FxHashSet::default();
|
||||
|
||||
// All body-owners have MIR associated with them.
|
||||
|
@ -10,7 +10,7 @@ use super::spanview::write_mir_fn_spanview;
|
||||
use crate::transform::MirSource;
|
||||
use either::Either;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_index::vec::Idx;
|
||||
use rustc_middle::mir::interpret::{
|
||||
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> {
|
||||
if let Some(i) = single {
|
||||
vec![i]
|
||||
} else {
|
||||
tcx.mir_keys(LOCAL_CRATE).iter().map(|def_id| def_id.to_def_id()).collect()
|
||||
tcx.mir_keys(()).iter().map(|def_id| def_id.to_def_id()).collect()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user