From b74e97cf42e647d87d67a03c134a0494b6aaa811 Mon Sep 17 00:00:00 2001 From: John Kåre Alsaker Date: Tue, 27 Feb 2018 17:11:14 +0100 Subject: Replace Rc with Lrc for shared data --- src/libsyntax_pos/lib.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/libsyntax_pos') 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>, + pub src: Option>, /// 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, + pub file: Lrc, /// 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>, + pub file: Option>, } // used to be structural records. Better names, anyone? #[derive(Debug)] -pub struct FileMapAndLine { pub fm: Rc, pub line: usize } +pub struct FileMapAndLine { pub fm: Lrc, pub line: usize } #[derive(Debug)] -pub struct FileMapAndBytePos { pub fm: Rc, pub pos: BytePos } +pub struct FileMapAndBytePos { pub fm: Lrc, 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, + pub file: Lrc, pub lines: Vec } -- cgit 1.4.1-3-g733a5