@@ -38,7 +38,7 @@ use rustc_session::config::{nightly_options, CG_OPTIONS, Z_OPTIONS};
3838use rustc_session:: config:: { ErrorOutputType , Input , OutFileName , OutputType , TrimmedDefPaths } ;
3939use rustc_session:: getopts:: { self , Matches } ;
4040use rustc_session:: lint:: { Lint , LintId } ;
41- use rustc_session:: { config, EarlyErrorHandler , Session } ;
41+ use rustc_session:: { config, EarlyDiagCtxt , Session } ;
4242use rustc_span:: def_id:: LOCAL_CRATE ;
4343use rustc_span:: source_map:: FileLoader ;
4444use rustc_span:: symbol:: sym;
@@ -291,7 +291,7 @@ fn run_compiler(
291291 >,
292292 using_internal_features: Arc <std:: sync:: atomic:: AtomicBool >,
293293) -> interface:: Result <( ) > {
294- let mut default_handler = EarlyErrorHandler :: new( ErrorOutputType :: default ( ) ) ;
294+ let mut default_handler = EarlyDiagCtxt :: new( ErrorOutputType :: default ( ) ) ;
295295
296296 // Throw away the first argument, the name of the binary.
297297 // In case of at_args being empty, as might be the case by
@@ -369,7 +369,7 @@ fn run_compiler(
369369 return sess. compile_status( ) ;
370370 }
371371
372- let handler = EarlyErrorHandler :: new( sess. opts. error_format) ;
372+ let handler = EarlyDiagCtxt :: new( sess. opts. error_format) ;
373373
374374 if print_crate_info( & handler, codegen_backend, sess, has_input) == Compilation :: Stop {
375375 return sess. compile_status( ) ;
@@ -495,7 +495,7 @@ fn make_output(matches: &getopts::Matches) -> (Option<PathBuf>, Option<OutFileNa
495495
496496// Extract input (string or file and optional path) from matches.
497497fn make_input(
498- handler: & EarlyErrorHandler ,
498+ handler: & EarlyDiagCtxt ,
499499 free_matches: & [ String ] ,
500500) -> Result <Option <Input >, ErrorGuaranteed > {
501501 if free_matches. len( ) == 1 {
@@ -537,7 +537,7 @@ pub enum Compilation {
537537 Continue ,
538538}
539539
540- fn handle_explain( handler: & EarlyErrorHandler , registry: Registry , code: & str , color: ColorConfig ) {
540+ fn handle_explain( handler: & EarlyDiagCtxt , registry: Registry , code: & str , color: ColorConfig ) {
541541 let upper_cased_code = code. to_ascii_uppercase( ) ;
542542 let normalised =
543543 if upper_cased_code. starts_with( 'E' ) { upper_cased_code } else { format!( "E{code:0>4}" ) } ;
@@ -669,11 +669,7 @@ fn process_rlink(sess: &Session, compiler: &interface::Compiler) {
669669 }
670670}
671671
672- fn list_metadata(
673- handler: & EarlyErrorHandler ,
674- sess: & Session ,
675- metadata_loader: & dyn MetadataLoader ,
676- ) {
672+ fn list_metadata( handler: & EarlyDiagCtxt , sess: & Session , metadata_loader: & dyn MetadataLoader ) {
677673 match sess. io. input {
678674 Input :: File ( ref ifile) => {
679675 let path = & ( * ifile) ;
@@ -695,7 +691,7 @@ fn list_metadata(
695691}
696692
697693fn print_crate_info(
698- handler: & EarlyErrorHandler ,
694+ handler: & EarlyDiagCtxt ,
699695 codegen_backend: & dyn CodegenBackend ,
700696 sess: & Session ,
701697 parse_attrs: bool ,
@@ -873,7 +869,7 @@ pub macro version($handler: expr, $binary: literal, $matches: expr) {
873869
874870#[ doc( hidden) ] // use the macro instead
875871pub fn version_at_macro_invocation(
876- handler: & EarlyErrorHandler ,
872+ handler: & EarlyDiagCtxt ,
877873 binary: & str ,
878874 matches: & getopts:: Matches ,
879875 version: & str ,
@@ -1072,7 +1068,7 @@ Available lint options:
10721068/// Show help for flag categories shared between rustdoc and rustc.
10731069///
10741070/// Returns whether a help option was printed.
1075- pub fn describe_flag_categories( handler: & EarlyErrorHandler , matches: & Matches ) -> bool {
1071+ pub fn describe_flag_categories( handler: & EarlyDiagCtxt , matches: & Matches ) -> bool {
10761072 // Handle the special case of -Wall.
10771073 let wall = matches. opt_strs( "W" ) ;
10781074 if wall. iter( ) . any( |x| * x == "all" ) {
@@ -1160,7 +1156,7 @@ fn print_flag_list<T>(
11601156/// This does not need to be `pub` for rustc itself, but @chaosite needs it to
11611157/// be public when using rustc as a library, see
11621158/// <https://github.com/rust-lang/rust/commit/2b4c33817a5aaecabf4c6598d41e190080ec119e>
1163- pub fn handle_options( handler: & EarlyErrorHandler , args: & [ String ] ) -> Option <getopts:: Matches > {
1159+ pub fn handle_options( handler: & EarlyDiagCtxt , args: & [ String ] ) -> Option <getopts:: Matches > {
11641160 if args. is_empty( ) {
11651161 // user did not write `-v` nor `-Z unstable-options`, so do not
11661162 // include that extra information.
@@ -1336,7 +1332,7 @@ pub fn install_ice_hook(
13361332 if msg. starts_with( "failed printing to stdout: " ) && msg. ends_with( "(os error 232)" )
13371333 {
13381334 // the error code is already going to be reported when the panic unwinds up the stack
1339- let handler = EarlyErrorHandler :: new( ErrorOutputType :: default ( ) ) ;
1335+ let handler = EarlyDiagCtxt :: new( ErrorOutputType :: default ( ) ) ;
13401336 let _ = handler. early_error_no_abort( msg. clone( ) ) ;
13411337 return ;
13421338 }
@@ -1476,14 +1472,14 @@ fn report_ice(
14761472
14771473/// This allows tools to enable rust logging without having to magically match rustc's
14781474/// tracing crate version.
1479- pub fn init_rustc_env_logger( handler: & EarlyErrorHandler ) {
1475+ pub fn init_rustc_env_logger( handler: & EarlyDiagCtxt ) {
14801476 init_logger( handler, rustc_log:: LoggerConfig :: from_env( "RUSTC_LOG" ) ) ;
14811477}
14821478
14831479/// This allows tools to enable rust logging without having to magically match rustc's
14841480/// tracing crate version. In contrast to `init_rustc_env_logger` it allows you to choose
14851481/// the values directly rather than having to set an environment variable.
1486- pub fn init_logger( handler: & EarlyErrorHandler , cfg: rustc_log:: LoggerConfig ) {
1482+ pub fn init_logger( handler: & EarlyDiagCtxt , cfg: rustc_log:: LoggerConfig ) {
14871483 if let Err ( error) = rustc_log:: init_logger( cfg) {
14881484 handler. early_error( error. to_string( ) ) ;
14891485 }
@@ -1493,7 +1489,7 @@ pub fn main() -> ! {
14931489 let start_time = Instant :: now( ) ;
14941490 let start_rss = get_resident_set_size( ) ;
14951491
1496- let handler = EarlyErrorHandler :: new( ErrorOutputType :: default ( ) ) ;
1492+ let handler = EarlyDiagCtxt :: new( ErrorOutputType :: default ( ) ) ;
14971493
14981494 init_rustc_env_logger( & handler) ;
14991495 signal_handler:: install( ) ;
0 commit comments