Auto merge of #114104 - oli-obk:syn2, r=compiler-errors

Lots of tiny incremental simplifications of `EmitterWriter` internals

ignore the first commit, it's https://github.com/rust-lang/rust/pull/114088 squashed and rebased, but it's needed to use to use `derive_setters`, as they need a newer `syn` version.

Then this PR starts out with removing many arguments that are almost always defaulted to `None` or `false` and replace them with builder methods that can set these fields in the few cases that want to set them.

After that it's one commit after the other that removes or merges things until everything becomes some very simple trait objects
This commit is contained in:
bors 2023-08-04 18:46:19 +00:00
commit e6c4606bfe

View File

@ -4,7 +4,7 @@
use rustc_data_structures::sync::{Lrc, Send}; use rustc_data_structures::sync::{Lrc, Send};
use rustc_errors::emitter::{Emitter, EmitterWriter}; use rustc_errors::emitter::{Emitter, EmitterWriter};
use rustc_errors::translation::Translate; use rustc_errors::translation::Translate;
use rustc_errors::{ColorConfig, Diagnostic, Handler, Level as DiagnosticLevel, TerminalUrl}; use rustc_errors::{ColorConfig, Diagnostic, Handler, Level as DiagnosticLevel};
use rustc_session::parse::ParseSess as RawParseSess; use rustc_session::parse::ParseSess as RawParseSess;
use rustc_span::{ use rustc_span::{
source_map::{FilePathMapping, SourceMap}, source_map::{FilePathMapping, SourceMap},
@ -139,18 +139,7 @@ fn default_handler(
rustc_driver::DEFAULT_LOCALE_RESOURCES.to_vec(), rustc_driver::DEFAULT_LOCALE_RESOURCES.to_vec(),
false, false,
); );
Box::new(EmitterWriter::stderr( Box::new(EmitterWriter::stderr(emit_color, fallback_bundle).sm(Some(source_map.clone())))
emit_color,
Some(source_map.clone()),
None,
fallback_bundle,
false,
false,
None,
false,
false,
TerminalUrl::No,
))
}; };
Handler::with_emitter(Box::new(SilentOnIgnoredFilesEmitter { Handler::with_emitter(Box::new(SilentOnIgnoredFilesEmitter {
has_non_ignorable_parser_errors: false, has_non_ignorable_parser_errors: false,