1
Fork 0

tree-wide: parallel: Fully removed all Lrc, replaced with Arc

This commit is contained in:
Askar Safin 2025-02-03 06:44:41 +03:00
parent 613bdd4997
commit 0a21f1d0a2
77 changed files with 405 additions and 395 deletions

View file

@ -83,11 +83,12 @@ use std::io::{self, Read};
use std::ops::{Add, Range, Sub};
use std::path::{Path, PathBuf};
use std::str::FromStr;
use std::sync::Arc;
use std::{fmt, iter};
use md5::{Digest, Md5};
use rustc_data_structures::stable_hasher::{Hash64, Hash128, HashStable, StableHasher};
use rustc_data_structures::sync::{FreezeLock, FreezeWriteGuard, Lock, Lrc};
use rustc_data_structures::sync::{FreezeLock, FreezeWriteGuard, Lock};
use rustc_data_structures::unord::UnordMap;
use sha1::Sha1;
use sha2::Sha256;
@ -110,7 +111,7 @@ pub struct SessionGlobals {
/// The session's source map, if there is one. This field should only be
/// used in places where the `Session` is truly not available, such as
/// `<Span as Debug>::fmt`.
source_map: Option<Lrc<SourceMap>>,
source_map: Option<Arc<SourceMap>>,
}
impl SessionGlobals {
@ -120,7 +121,7 @@ impl SessionGlobals {
span_interner: Lock::new(span_encoding::SpanInterner::default()),
metavar_spans: Default::default(),
hygiene_data: Lock::new(hygiene::HygieneData::new(edition)),
source_map: sm_inputs.map(|inputs| Lrc::new(SourceMap::with_inputs(inputs))),
source_map: sm_inputs.map(|inputs| Arc::new(SourceMap::with_inputs(inputs))),
}
}
}
@ -1430,7 +1431,7 @@ pub enum ExternalSource {
#[derive(PartialEq, Eq, Clone, Debug)]
pub enum ExternalSourceKind {
/// The external source has been loaded already.
Present(Lrc<String>),
Present(Arc<String>),
/// No attempt has been made to load the external source.
AbsentOk,
/// A failed attempt has been made to load the external source.
@ -1670,7 +1671,7 @@ pub struct SourceFile {
/// (e.g., `<anon>`).
pub name: FileName,
/// The complete source code.
pub src: Option<Lrc<String>>,
pub src: Option<Arc<String>>,
/// The source code's hash.
pub src_hash: SourceFileHash,
/// Used to enable cargo to use checksums to check if a crate is fresh rather
@ -1931,7 +1932,7 @@ impl SourceFile {
Ok(SourceFile {
name,
src: Some(Lrc::new(src)),
src: Some(Arc::new(src)),
src_hash,
checksum_hash,
external_src: FreezeLock::frozen(ExternalSource::Unneeded),
@ -2050,7 +2051,7 @@ impl SourceFile {
} = &mut *external_src
{
*src_kind = if let Some(src) = src {
ExternalSourceKind::Present(Lrc::new(src))
ExternalSourceKind::Present(Arc::new(src))
} else {
ExternalSourceKind::AbsentErr
};
@ -2490,7 +2491,7 @@ impl<D: Decoder> Decodable<D> for RelativeBytePos {
#[derive(Debug, Clone)]
pub struct Loc {
/// Information about the original source.
pub file: Lrc<SourceFile>,
pub file: Arc<SourceFile>,
/// The (1-based) line number.
pub line: usize,
/// The (0-based) column offset.
@ -2502,13 +2503,13 @@ pub struct Loc {
// Used to be structural records.
#[derive(Debug)]
pub struct SourceFileAndLine {
pub sf: Lrc<SourceFile>,
pub sf: Arc<SourceFile>,
/// Index of line, starting from 0.
pub line: usize,
}
#[derive(Debug)]
pub struct SourceFileAndBytePos {
pub sf: Lrc<SourceFile>,
pub sf: Arc<SourceFile>,
pub pos: BytePos,
}
@ -2525,7 +2526,7 @@ pub struct LineInfo {
}
pub struct FileLines {
pub file: Lrc<SourceFile>,
pub file: Arc<SourceFile>,
pub lines: Vec<LineInfo>,
}
@ -2591,7 +2592,7 @@ pub trait HashStableContext {
fn span_data_to_lines_and_cols(
&mut self,
span: &SpanData,
) -> Option<(Lrc<SourceFile>, usize, BytePos, usize, BytePos)>;
) -> Option<(Arc<SourceFile>, usize, BytePos, usize, BytePos)>;
fn hashing_controls(&self) -> HashingControls;
}