Replace Rc with Lrc for shared data

This commit is contained in:
John Kåre Alsaker
2018-02-27 17:11:14 +01:00
parent 878f5b0514
commit b74e97cf42
86 changed files with 435 additions and 413 deletions

View File

@@ -26,7 +26,7 @@ use errors::{DiagnosticBuilder, SubDiagnostic, CodeSuggestion, CodeMapper};
use errors::DiagnosticId;
use errors::emitter::{Emitter, EmitterWriter};
use std::rc::Rc;
use rustc_data_structures::sync::Lrc;
use std::io::{self, Write};
use std::vec;
use std::sync::{Arc, Mutex};
@@ -36,7 +36,7 @@ use rustc_serialize::json::{as_json, as_pretty_json};
pub struct JsonEmitter {
dst: Box<Write + Send>,
registry: Option<Registry>,
cm: Rc<CodeMapper + 'static>,
cm: Lrc<CodeMapper + 'static>,
pretty: bool,
/// Whether "approximate suggestions" are enabled in the config
approximate_suggestions: bool,
@@ -45,7 +45,7 @@ pub struct JsonEmitter {
impl JsonEmitter {
pub fn stderr(registry: Option<Registry>,
code_map: Rc<CodeMap>,
code_map: Lrc<CodeMap>,
pretty: bool,
approximate_suggestions: bool) -> JsonEmitter {
JsonEmitter {
@@ -60,13 +60,13 @@ impl JsonEmitter {
pub fn basic(pretty: bool) -> JsonEmitter {
let file_path_mapping = FilePathMapping::empty();
JsonEmitter::stderr(None, Rc::new(CodeMap::new(file_path_mapping)),
JsonEmitter::stderr(None, Lrc::new(CodeMap::new(file_path_mapping)),
pretty, false)
}
pub fn new(dst: Box<Write + Send>,
registry: Option<Registry>,
code_map: Rc<CodeMap>,
code_map: Lrc<CodeMap>,
pretty: bool,
approximate_suggestions: bool) -> JsonEmitter {
JsonEmitter {