tree-wide: parallel: Fully removed all Lrc
, replaced with Arc
This commit is contained in:
parent
613bdd4997
commit
0a21f1d0a2
77 changed files with 405 additions and 395 deletions
|
@ -2,11 +2,12 @@
|
|||
//! It also serves as an input to the parser itself.
|
||||
|
||||
use std::str;
|
||||
use std::sync::Arc;
|
||||
|
||||
use rustc_ast::attr::AttrIdGenerator;
|
||||
use rustc_ast::node_id::NodeId;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxIndexMap, FxIndexSet};
|
||||
use rustc_data_structures::sync::{AppendOnlyVec, Lock, Lrc};
|
||||
use rustc_data_structures::sync::{AppendOnlyVec, Lock};
|
||||
use rustc_errors::emitter::{HumanEmitter, SilentEmitter, stderr_destination};
|
||||
use rustc_errors::{
|
||||
ColorConfig, Diag, DiagCtxt, DiagCtxtHandle, DiagMessage, EmissionGuarantee, MultiSpan,
|
||||
|
@ -214,7 +215,7 @@ pub struct ParseSess {
|
|||
/// should be. Useful to avoid bad tokenization when encountering emoji. We group them to
|
||||
/// provide a single error per unique incorrect identifier.
|
||||
pub bad_unicode_identifiers: Lock<FxIndexMap<Symbol, Vec<Span>>>,
|
||||
source_map: Lrc<SourceMap>,
|
||||
source_map: Arc<SourceMap>,
|
||||
pub buffered_lints: Lock<Vec<BufferedEarlyLint>>,
|
||||
/// Contains the spans of block expressions that could have been incomplete based on the
|
||||
/// operation token that followed it, but that the parser cannot identify without further
|
||||
|
@ -239,16 +240,16 @@ impl ParseSess {
|
|||
/// Used for testing.
|
||||
pub fn new(locale_resources: Vec<&'static str>) -> Self {
|
||||
let fallback_bundle = fallback_fluent_bundle(locale_resources, false);
|
||||
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
|
||||
let sm = Arc::new(SourceMap::new(FilePathMapping::empty()));
|
||||
let emitter = Box::new(
|
||||
HumanEmitter::new(stderr_destination(ColorConfig::Auto), fallback_bundle)
|
||||
.sm(Some(Lrc::clone(&sm))),
|
||||
.sm(Some(Arc::clone(&sm))),
|
||||
);
|
||||
let dcx = DiagCtxt::new(emitter);
|
||||
ParseSess::with_dcx(dcx, sm)
|
||||
}
|
||||
|
||||
pub fn with_dcx(dcx: DiagCtxt, source_map: Lrc<SourceMap>) -> Self {
|
||||
pub fn with_dcx(dcx: DiagCtxt, source_map: Arc<SourceMap>) -> Self {
|
||||
Self {
|
||||
dcx,
|
||||
unstable_features: UnstableFeatures::from_environment(None),
|
||||
|
@ -276,7 +277,7 @@ impl ParseSess {
|
|||
emit_fatal_diagnostic: bool,
|
||||
) -> Self {
|
||||
let fallback_bundle = fallback_fluent_bundle(locale_resources, false);
|
||||
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
|
||||
let sm = Arc::new(SourceMap::new(FilePathMapping::empty()));
|
||||
let fatal_emitter =
|
||||
Box::new(HumanEmitter::new(stderr_destination(ColorConfig::Auto), fallback_bundle));
|
||||
let dcx = DiagCtxt::new(Box::new(SilentEmitter {
|
||||
|
@ -293,8 +294,8 @@ impl ParseSess {
|
|||
&self.source_map
|
||||
}
|
||||
|
||||
pub fn clone_source_map(&self) -> Lrc<SourceMap> {
|
||||
Lrc::clone(&self.source_map)
|
||||
pub fn clone_source_map(&self) -> Arc<SourceMap> {
|
||||
Arc::clone(&self.source_map)
|
||||
}
|
||||
|
||||
pub fn buffer_lint(
|
||||
|
|
|
@ -9,9 +9,7 @@ use std::{env, fmt, io};
|
|||
use rustc_data_structures::flock;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxIndexSet};
|
||||
use rustc_data_structures::profiling::{SelfProfiler, SelfProfilerRef};
|
||||
use rustc_data_structures::sync::{
|
||||
DynSend, DynSync, Lock, Lrc, MappedReadGuard, ReadGuard, RwLock,
|
||||
};
|
||||
use rustc_data_structures::sync::{DynSend, DynSync, Lock, MappedReadGuard, ReadGuard, RwLock};
|
||||
use rustc_errors::annotate_snippet_emitter_writer::AnnotateSnippetEmitter;
|
||||
use rustc_errors::codes::*;
|
||||
use rustc_errors::emitter::{
|
||||
|
@ -138,8 +136,8 @@ pub struct Session {
|
|||
pub target: Target,
|
||||
pub host: Target,
|
||||
pub opts: config::Options,
|
||||
pub host_tlib_path: Lrc<SearchPath>,
|
||||
pub target_tlib_path: Lrc<SearchPath>,
|
||||
pub host_tlib_path: Arc<SearchPath>,
|
||||
pub target_tlib_path: Arc<SearchPath>,
|
||||
pub psess: ParseSess,
|
||||
pub sysroot: PathBuf,
|
||||
/// Input, input file path and output file path to this compilation process.
|
||||
|
@ -154,7 +152,7 @@ pub struct Session {
|
|||
pub code_stats: CodeStats,
|
||||
|
||||
/// This only ever stores a `LintStore` but we don't want a dependency on that type here.
|
||||
pub lint_store: Option<Lrc<dyn LintStoreMarker>>,
|
||||
pub lint_store: Option<Arc<dyn LintStoreMarker>>,
|
||||
|
||||
/// Cap lint level specified by a driver specifically.
|
||||
pub driver_lint_caps: FxHashMap<lint::LintId, lint::Level>,
|
||||
|
@ -881,8 +879,8 @@ impl Session {
|
|||
#[allow(rustc::bad_opt_access)]
|
||||
fn default_emitter(
|
||||
sopts: &config::Options,
|
||||
source_map: Lrc<SourceMap>,
|
||||
bundle: Option<Lrc<FluentBundle>>,
|
||||
source_map: Arc<SourceMap>,
|
||||
bundle: Option<Arc<FluentBundle>>,
|
||||
fallback_bundle: LazyFallbackBundle,
|
||||
) -> Box<DynEmitter> {
|
||||
let macro_backtrace = sopts.unstable_opts.macro_backtrace;
|
||||
|
@ -966,7 +964,7 @@ pub fn build_session(
|
|||
early_dcx: EarlyDiagCtxt,
|
||||
sopts: config::Options,
|
||||
io: CompilerIO,
|
||||
bundle: Option<Lrc<rustc_errors::FluentBundle>>,
|
||||
bundle: Option<Arc<rustc_errors::FluentBundle>>,
|
||||
registry: rustc_errors::registry::Registry,
|
||||
fluent_resources: Vec<&'static str>,
|
||||
driver_lint_caps: FxHashMap<lint::LintId, lint::Level>,
|
||||
|
@ -1001,7 +999,7 @@ pub fn build_session(
|
|||
sopts.unstable_opts.translate_directionality_markers,
|
||||
);
|
||||
let source_map = rustc_span::source_map::get_source_map().unwrap();
|
||||
let emitter = default_emitter(&sopts, Lrc::clone(&source_map), bundle, fallback_bundle);
|
||||
let emitter = default_emitter(&sopts, Arc::clone(&source_map), bundle, fallback_bundle);
|
||||
|
||||
let mut dcx = DiagCtxt::new(emitter)
|
||||
.with_flags(sopts.unstable_opts.dcx_flags(can_emit_warnings))
|
||||
|
@ -1041,13 +1039,13 @@ pub fn build_session(
|
|||
|
||||
let host_triple = config::host_tuple();
|
||||
let target_triple = sopts.target_triple.tuple();
|
||||
let host_tlib_path = Lrc::new(SearchPath::from_sysroot_and_triple(&sysroot, host_triple));
|
||||
let host_tlib_path = Arc::new(SearchPath::from_sysroot_and_triple(&sysroot, host_triple));
|
||||
let target_tlib_path = if host_triple == target_triple {
|
||||
// Use the same `SearchPath` if host and target triple are identical to avoid unnecessary
|
||||
// rescanning of the target lib path and an unnecessary allocation.
|
||||
Lrc::clone(&host_tlib_path)
|
||||
Arc::clone(&host_tlib_path)
|
||||
} else {
|
||||
Lrc::new(SearchPath::from_sysroot_and_triple(&sysroot, target_triple))
|
||||
Arc::new(SearchPath::from_sysroot_and_triple(&sysroot, target_triple))
|
||||
};
|
||||
|
||||
let prof = SelfProfilerRef::new(
|
||||
|
@ -1442,7 +1440,7 @@ fn mk_emitter(output: ErrorOutputType) -> Box<DynEmitter> {
|
|||
config::ErrorOutputType::Json { pretty, json_rendered, color_config } => {
|
||||
Box::new(JsonEmitter::new(
|
||||
Box::new(io::BufWriter::new(io::stderr())),
|
||||
Some(Lrc::new(SourceMap::new(FilePathMapping::empty()))),
|
||||
Some(Arc::new(SourceMap::new(FilePathMapping::empty()))),
|
||||
fallback_bundle,
|
||||
pretty,
|
||||
json_rendered,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue