diff options
Diffstat (limited to 'compiler/rustc_span/src/lib.rs')
| -rw-r--r-- | compiler/rustc_span/src/lib.rs | 32 | 
1 files changed, 17 insertions, 15 deletions
| diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs index b1f9f4a01c5..c09669d959c 100644 --- a/compiler/rustc_span/src/lib.rs +++ b/compiler/rustc_span/src/lib.rs @@ -83,12 +83,14 @@ 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::stable_hasher::{HashStable, StableHasher}; +use rustc_data_structures::sync::{FreezeLock, FreezeWriteGuard, Lock}; use rustc_data_structures::unord::UnordMap; +use rustc_hashes::{Hash64, Hash128}; use sha1::Sha1; use sha2::Sha256; @@ -110,7 +112,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 +122,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))), } } } @@ -402,7 +404,7 @@ impl fmt::Display for FileNameDisplay<'_> { impl<'a> FileNameDisplay<'a> { pub fn to_string_lossy(&self) -> Cow<'a, str> { match self.inner { - FileName::Real(ref inner) => inner.to_string_lossy(self.display_pref), + FileName::Real(inner) => inner.to_string_lossy(self.display_pref), _ => Cow::from(self.to_string()), } } @@ -1430,7 +1432,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. @@ -1440,7 +1442,7 @@ pub enum ExternalSourceKind { impl ExternalSource { pub fn get_source(&self) -> Option<&str> { match self { - ExternalSource::Foreign { kind: ExternalSourceKind::Present(ref src), .. } => Some(src), + ExternalSource::Foreign { kind: ExternalSourceKind::Present(src), .. } => Some(src), _ => None, } } @@ -1670,7 +1672,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 +1933,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 +2052,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 +2492,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 +2504,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 +2527,7 @@ pub struct LineInfo { } pub struct FileLines { - pub file: Lrc<SourceFile>, + pub file: Arc<SourceFile>, pub lines: Vec<LineInfo>, } @@ -2591,7 +2593,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; } | 
