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/librustc_errors | |
| parent | 878f5b05147480182ea4d8a855acc55bfeb16c22 (diff) | |
| download | rust-b74e97cf42e647d87d67a03c134a0494b6aaa811.tar.gz rust-b74e97cf42e647d87d67a03c134a0494b6aaa811.zip | |
Replace Rc with Lrc for shared data
Diffstat (limited to 'src/librustc_errors')
| -rw-r--r-- | src/librustc_errors/emitter.rs | 14 | ||||
| -rw-r--r-- | src/librustc_errors/lib.rs | 8 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index 0bd9b7268cb..33fce7b1968 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -16,10 +16,10 @@ use {Level, CodeSuggestion, DiagnosticBuilder, SubDiagnostic, CodeMapper, Diagno use snippet::{Annotation, AnnotationType, Line, MultilineAnnotation, StyledString, Style}; use styled_buffer::StyledBuffer; +use rustc_data_structures::sync::Lrc; use std::borrow::Cow; use std::io::prelude::*; use std::io; -use std::rc::Rc; use term; use std::collections::{HashMap, HashSet}; use std::cmp::min; @@ -106,7 +106,7 @@ impl ColorConfig { pub struct EmitterWriter { dst: Destination, - cm: Option<Rc<CodeMapper>>, + cm: Option<Lrc<CodeMapper>>, short_message: bool, teach: bool, error_codes: HashSet<String>, @@ -114,7 +114,7 @@ pub struct EmitterWriter { } struct FileWithAnnotatedLines { - file: Rc<FileMap>, + file: Lrc<FileMap>, lines: Vec<Line>, multiline_depth: usize, } @@ -148,7 +148,7 @@ impl Drop for EmitterWriter { impl EmitterWriter { pub fn stderr(color_config: ColorConfig, - code_map: Option<Rc<CodeMapper>>, + code_map: Option<Lrc<CodeMapper>>, short_message: bool, teach: bool) -> EmitterWriter { @@ -175,7 +175,7 @@ impl EmitterWriter { } pub fn new(dst: Box<Write + Send>, - code_map: Option<Rc<CodeMapper>>, + code_map: Option<Lrc<CodeMapper>>, short_message: bool, teach: bool) -> EmitterWriter { @@ -204,7 +204,7 @@ impl EmitterWriter { fn preprocess_annotations(&mut self, msp: &MultiSpan) -> Vec<FileWithAnnotatedLines> { fn add_annotation_to_file(file_vec: &mut Vec<FileWithAnnotatedLines>, - file: Rc<FileMap>, + file: Lrc<FileMap>, line_index: usize, ann: Annotation) { @@ -336,7 +336,7 @@ impl EmitterWriter { fn render_source_line(&self, buffer: &mut StyledBuffer, - file: Rc<FileMap>, + file: Lrc<FileMap>, line: &Line, width_offset: usize, code_offset: usize) -> Vec<(usize, Style)> { diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index 236698ed2d4..3eea311a5af 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -35,13 +35,13 @@ use self::Level::*; use emitter::{Emitter, EmitterWriter}; +use rustc_data_structures::sync::Lrc; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::stable_hasher::StableHasher; use std::borrow::Cow; use std::cell::{RefCell, Cell}; use std::mem; -use std::rc::Rc; use std::{error, fmt}; use std::sync::atomic::AtomicUsize; use std::sync::atomic::Ordering::SeqCst; @@ -110,7 +110,7 @@ pub trait CodeMapper { fn span_to_filename(&self, sp: Span) -> FileName; fn merge_spans(&self, sp_lhs: Span, sp_rhs: Span) -> Option<Span>; fn call_span_if_macro(&self, sp: Span) -> Span; - fn ensure_filemap_source_present(&self, file_map: Rc<FileMap>) -> bool; + fn ensure_filemap_source_present(&self, file_map: Lrc<FileMap>) -> bool; fn doctest_offset_line(&self, line: usize) -> usize; } @@ -287,7 +287,7 @@ impl Handler { pub fn with_tty_emitter(color_config: ColorConfig, can_emit_warnings: bool, treat_err_as_bug: bool, - cm: Option<Rc<CodeMapper>>) + cm: Option<Lrc<CodeMapper>>) -> Handler { Handler::with_tty_emitter_and_flags( color_config, @@ -300,7 +300,7 @@ impl Handler { } pub fn with_tty_emitter_and_flags(color_config: ColorConfig, - cm: Option<Rc<CodeMapper>>, + cm: Option<Lrc<CodeMapper>>, flags: HandlerFlags) -> Handler { let emitter = Box::new(EmitterWriter::stderr(color_config, cm, false, false)); |
