Skip to content

Commit

Permalink
Auto merge of #116052 - oli-obk:ceci_nest_pas_une_query, r=WaffleLapkin
Browse files Browse the repository at this point in the history
Add a way to decouple the implementation and the declaration of a TyCtxt method.

properly addresses rust-lang/rust#115819

accepted MCP: rust-lang/compiler-team#395
  • Loading branch information
bors committed Sep 23, 2023
2 parents 73b3c86 0406c3c commit 212dae1
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/bin/miri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 28,8 @@ use rustc_middle::{
middle::exported_symbols::{
ExportedSymbol, SymbolExportInfo, SymbolExportKind, SymbolExportLevel,
},
query::{ExternProviders, LocalCrate},
query::{LocalCrate},
util::Providers,
ty::TyCtxt,
};
use rustc_session::config::{CrateType, ErrorOutputType, OptLevel};
Expand All @@ -43,11 44,11 @@ struct MiriCompilerCalls {

impl rustc_driver::Callbacks for MiriCompilerCalls {
fn config(&mut self, config: &mut Config) {
config.override_queries = Some(|_, _, external_providers| {
external_providers.used_crate_source = |tcx, cnum| {
let mut providers = ExternProviders::default();
rustc_metadata::provide_extern(&mut providers);
let mut crate_source = (providers.used_crate_source)(tcx, cnum);
config.override_queries = Some(|_, providers| {
providers.extern_queries.used_crate_source = |tcx, cnum| {
let mut providers = Providers::default();
rustc_metadata::provide(&mut providers);
let mut crate_source = (providers.extern_queries.used_crate_source)(tcx, cnum);
// HACK: rustc will emit "crate ... required to be available in rlib format, but
// was not found in this form" errors once we use `tcx.dependency_formats()` if
// there's no rlib provided, so setting a dummy path here to workaround those errors.
Expand Down Expand Up @@ -125,7 126,7 @@ impl rustc_driver::Callbacks for MiriBeRustCompilerCalls {
if config.opts.prints.is_empty() && self.target_crate {
// Queries overridden here affect the data stored in `rmeta` files of dependencies,
// which will be used later in non-`MIRI_BE_RUSTC` mode.
config.override_queries = Some(|_, local_providers, _| {
config.override_queries = Some(|_, local_providers| {
// `exported_symbols` and `reachable_non_generics` provided by rustc always returns
// an empty result if `tcx.sess.opts.output_types.should_codegen()` is false.
local_providers.exported_symbols = |tcx, LocalCrate| {
Expand Down

0 comments on commit 212dae1

Please sign in to comment.