errors: share SilentEmitter
between rustc and rustfmt
Signed-off-by: David Wood <david@davidtw.co>
This commit is contained in:
parent
5a1e5449c8
commit
2ee0409f32
7 changed files with 131 additions and 108 deletions
|
@ -265,14 +265,20 @@ impl ParseSess {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn with_silent_emitter(fatal_note: String) -> Self {
|
||||
let fallback_bundle = fallback_fluent_bundle(Vec::new(), false);
|
||||
pub fn with_silent_emitter(locale_resources: Vec<&'static str>, fatal_note: String) -> Self {
|
||||
let fallback_bundle = fallback_fluent_bundle(locale_resources, false);
|
||||
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
|
||||
let emitter =
|
||||
Box::new(HumanEmitter::new(stderr_destination(ColorConfig::Auto), fallback_bundle));
|
||||
let emitter = Box::new(HumanEmitter::new(
|
||||
stderr_destination(ColorConfig::Auto),
|
||||
fallback_bundle.clone(),
|
||||
));
|
||||
let fatal_dcx = DiagCtxt::new(emitter);
|
||||
let dcx =
|
||||
DiagCtxt::new(Box::new(SilentEmitter { fatal_dcx, fatal_note })).disable_warnings();
|
||||
let dcx = DiagCtxt::new(Box::new(SilentEmitter {
|
||||
fallback_bundle,
|
||||
fatal_dcx,
|
||||
fatal_note: Some(fatal_note),
|
||||
}))
|
||||
.disable_warnings();
|
||||
ParseSess::with_dcx(dcx, sm)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue