Auto merge of #1863 - hyd-dev:parallel-compiler, r=RalfJung

Use `Lrc` instead of `Rc` in `MiriCompilerCalls::config()`

The `used_crate_source` query defines its return type as [`Lrc<CrateSource>`](1195bea5a7/compiler/rustc_middle/src/query/mod.rs (L1418)), which would be `Arc` when `parallel-compiler = true`.

I assume this fixes rust-lang/rust#87623. I didn't test that locally -- I'm not interested in `parallel-compiler = true` enough to be willing to recompile rustc with that configuration to test it, but I'm submitting this in case it might be useful for `parallel-compiler = true` users.
This commit is contained in:
bors 2021-07-30 14:38:10 +00:00
commit 1f969da570

View File

@ -1,5 +1,6 @@
#![feature(rustc_private, bool_to_option, stmt_expr_attributes)] #![feature(rustc_private, bool_to_option, stmt_expr_attributes)]
extern crate rustc_data_structures;
extern crate rustc_driver; extern crate rustc_driver;
extern crate rustc_errors; extern crate rustc_errors;
extern crate rustc_hir; extern crate rustc_hir;
@ -12,12 +13,12 @@
use std::env; use std::env;
use std::num::NonZeroU64; use std::num::NonZeroU64;
use std::path::PathBuf; use std::path::PathBuf;
use std::rc::Rc;
use std::str::FromStr; use std::str::FromStr;
use hex::FromHexError; use hex::FromHexError;
use log::debug; use log::debug;
use rustc_data_structures::sync::Lrc;
use rustc_driver::Compilation; use rustc_driver::Compilation;
use rustc_errors::emitter::{ColorConfig, HumanReadableErrorType}; use rustc_errors::emitter::{ColorConfig, HumanReadableErrorType};
use rustc_hir::{self as hir, def_id::LOCAL_CRATE, Node}; use rustc_hir::{self as hir, def_id::LOCAL_CRATE, Node};
@ -42,7 +43,7 @@ fn config(&mut self, config: &mut Config) {
// HACK: rustc will emit "crate ... required to be available in rlib format, but // 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 // 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. // there's no rlib provided, so setting a dummy path here to workaround those errors.
Rc::make_mut(&mut crate_source).rlib = Some((PathBuf::new(), PathKind::All)); Lrc::make_mut(&mut crate_source).rlib = Some((PathBuf::new(), PathKind::All));
crate_source crate_source
}; };
}); });