Skip to content

Commit 96bec4c

Browse files
committed
Auto merge of #109092 - compiler-errors:local-key, r=cjgillot
Make local query providers receive local keys When a query is marked `separate_provide_extern`, we can map a query key to a "local" form of the key, e.g. `DefId` -> `LocalDefId`. This simplifies a ton of code which either has to assert or use something like `expect_local` to assert that the query key is local.
2 parents 3c06205 + 168aec6 commit 96bec4c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/bin/miri.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ use log::debug;
2222

2323
use rustc_data_structures::sync::Lrc;
2424
use rustc_driver::Compilation;
25-
use rustc_hir::{self as hir, def_id::LOCAL_CRATE, Node};
25+
use rustc_hir::{self as hir, Node};
2626
use rustc_interface::interface::Config;
2727
use rustc_middle::{
2828
middle::exported_symbols::{
2929
ExportedSymbol, SymbolExportInfo, SymbolExportKind, SymbolExportLevel,
3030
},
3131
ty::{query::ExternProviders, TyCtxt},
32+
query::LocalCrate,
3233
};
3334
use rustc_session::{config::CrateType, search_paths::PathKind, CtfeBacktrace};
3435

@@ -107,8 +108,7 @@ impl rustc_driver::Callbacks for MiriBeRustCompilerCalls {
107108
config.override_queries = Some(|_, local_providers, _| {
108109
// `exported_symbols` and `reachable_non_generics` provided by rustc always returns
109110
// an empty result if `tcx.sess.opts.output_types.should_codegen()` is false.
110-
local_providers.exported_symbols = |tcx, cnum| {
111-
assert_eq!(cnum, LOCAL_CRATE);
111+
local_providers.exported_symbols = |tcx, LocalCrate| {
112112
let reachable_set = tcx.with_stable_hashing_context(|hcx| {
113113
tcx.reachable_set(()).to_sorted(&hcx, true)
114114
});

0 commit comments

Comments
 (0)