diff options
| author | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2018-02-27 17:11:14 +0100 |
|---|---|---|
| committer | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2018-03-02 10:48:52 +0100 |
| commit | b74e97cf42e647d87d67a03c134a0494b6aaa811 (patch) | |
| tree | a66e948a4d31dd9681cb6984a3b1fb774bebae4a /src/libsyntax_pos | |
| parent | 878f5b05147480182ea4d8a855acc55bfeb16c22 (diff) | |
Replace Rc with Lrc for shared data
Diffstat (limited to 'src/libsyntax_pos')
| -rw-r--r-- | src/libsyntax_pos/lib.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs index e2c6b1b0c92..9f746adbe65 100644 --- a/src/libsyntax_pos/lib.rs +++ b/src/libsyntax_pos/lib.rs @@ -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> } |
