Auto merge of #49349 - Zoxc:sync-errors, r=michaelwoerister

Make Handler more thread-safe

The use of `code_emitted` to suppress extended explanations is not thread safe. I'm not sure why we keep the documentation for errors outside `diagnostics.rs` anyway. It would be better to add a `teach` method to `DiagnosticsBuilder`, so instead of:
```
if self.tcx.sess.teach(&err.get_code().unwrap()) {
    err.note("...");
}
```
we'd use `err.teach("...")`

cc @estebank

r? @michaelwoerister
This commit is contained in:
bors 2018-04-18 08:29:14 +00:00
commit f4bb956278
4 changed files with 40 additions and 35 deletions

View file

@ -35,7 +35,7 @@ use errors::emitter::{Emitter, EmitterWriter};
use std::cell::{RefCell, Cell};
use std::mem;
use rustc_data_structures::sync::Lrc;
use rustc_data_structures::sync::{self, Lrc};
use std::rc::Rc;
use std::path::PathBuf;
@ -163,7 +163,7 @@ pub fn run_core(search_paths: SearchPaths,
};
let codemap = Lrc::new(codemap::CodeMap::new(sessopts.file_path_mapping()));
let emitter: Box<dyn Emitter> = match error_format {
let emitter: Box<dyn Emitter + sync::Send> = match error_format {
ErrorOutputType::HumanReadable(color_config) => Box::new(
EmitterWriter::stderr(
color_config,