Replace Rc with Lrc for shared data
This commit is contained in:
parent
878f5b0514
commit
b74e97cf42
86 changed files with 435 additions and 413 deletions
|
@ -33,9 +33,9 @@ use std::fmt;
|
|||
use std::hash::{Hasher, Hash};
|
||||
use std::ops::{Add, Sub};
|
||||
use std::path::PathBuf;
|
||||
use std::rc::Rc;
|
||||
|
||||
use rustc_data_structures::stable_hasher::StableHasher;
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
|
||||
extern crate rustc_data_structures;
|
||||
|
||||
|
@ -678,7 +678,7 @@ pub struct FileMap {
|
|||
/// Indicates which crate this FileMap was imported from.
|
||||
pub crate_of_origin: u32,
|
||||
/// The complete source code
|
||||
pub src: Option<Rc<String>>,
|
||||
pub src: Option<Lrc<String>>,
|
||||
/// The source code's hash
|
||||
pub src_hash: u128,
|
||||
/// The external source code (used for external crates, which will have a `None`
|
||||
|
@ -864,7 +864,7 @@ impl FileMap {
|
|||
name_was_remapped,
|
||||
unmapped_path: Some(unmapped_path),
|
||||
crate_of_origin: 0,
|
||||
src: Some(Rc::new(src)),
|
||||
src: Some(Lrc::new(src)),
|
||||
src_hash,
|
||||
external_src: RefCell::new(ExternalSource::Unneeded),
|
||||
start_pos,
|
||||
|
@ -1127,7 +1127,7 @@ impl Sub for CharPos {
|
|||
#[derive(Debug, Clone)]
|
||||
pub struct Loc {
|
||||
/// Information about the original source
|
||||
pub file: Rc<FileMap>,
|
||||
pub file: Lrc<FileMap>,
|
||||
/// The (1-based) line number
|
||||
pub line: usize,
|
||||
/// The (0-based) column offset
|
||||
|
@ -1144,14 +1144,14 @@ pub struct LocWithOpt {
|
|||
pub filename: FileName,
|
||||
pub line: usize,
|
||||
pub col: CharPos,
|
||||
pub file: Option<Rc<FileMap>>,
|
||||
pub file: Option<Lrc<FileMap>>,
|
||||
}
|
||||
|
||||
// used to be structural records. Better names, anyone?
|
||||
#[derive(Debug)]
|
||||
pub struct FileMapAndLine { pub fm: Rc<FileMap>, pub line: usize }
|
||||
pub struct FileMapAndLine { pub fm: Lrc<FileMap>, pub line: usize }
|
||||
#[derive(Debug)]
|
||||
pub struct FileMapAndBytePos { pub fm: Rc<FileMap>, pub pos: BytePos }
|
||||
pub struct FileMapAndBytePos { pub fm: Lrc<FileMap>, pub pos: BytePos }
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
pub struct LineInfo {
|
||||
|
@ -1166,7 +1166,7 @@ pub struct LineInfo {
|
|||
}
|
||||
|
||||
pub struct FileLines {
|
||||
pub file: Rc<FileMap>,
|
||||
pub file: Lrc<FileMap>,
|
||||
pub lines: Vec<LineInfo>
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue