@@ -38,7 +38,7 @@ use rustc_session::config::{nightly_options, CG_OPTIONS, Z_OPTIONS};
38
38
use rustc_session:: config:: { ErrorOutputType , Input , OutFileName , OutputType , TrimmedDefPaths } ;
39
39
use rustc_session:: getopts:: { self , Matches } ;
40
40
use rustc_session:: lint:: { Lint , LintId } ;
41
- use rustc_session:: { config, EarlyErrorHandler , Session } ;
41
+ use rustc_session:: { config, EarlyDiagCtxt , Session } ;
42
42
use rustc_span:: def_id:: LOCAL_CRATE ;
43
43
use rustc_span:: source_map:: FileLoader ;
44
44
use rustc_span:: symbol:: sym;
@@ -291,7 +291,7 @@ fn run_compiler(
291
291
>,
292
292
using_internal_features: Arc <std:: sync:: atomic:: AtomicBool >,
293
293
) -> interface:: Result <( ) > {
294
- let mut default_handler = EarlyErrorHandler :: new( ErrorOutputType :: default ( ) ) ;
294
+ let mut default_handler = EarlyDiagCtxt :: new( ErrorOutputType :: default ( ) ) ;
295
295
296
296
// Throw away the first argument, the name of the binary.
297
297
// In case of at_args being empty, as might be the case by
@@ -369,7 +369,7 @@ fn run_compiler(
369
369
return sess. compile_status( ) ;
370
370
}
371
371
372
- let handler = EarlyErrorHandler :: new( sess. opts. error_format) ;
372
+ let handler = EarlyDiagCtxt :: new( sess. opts. error_format) ;
373
373
374
374
if print_crate_info( & handler, codegen_backend, sess, has_input) == Compilation :: Stop {
375
375
return sess. compile_status( ) ;
@@ -495,7 +495,7 @@ fn make_output(matches: &getopts::Matches) -> (Option<PathBuf>, Option<OutFileNa
495
495
496
496
// Extract input (string or file and optional path) from matches.
497
497
fn make_input(
498
- handler: & EarlyErrorHandler ,
498
+ handler: & EarlyDiagCtxt ,
499
499
free_matches: & [ String ] ,
500
500
) -> Result <Option <Input >, ErrorGuaranteed > {
501
501
if free_matches. len( ) == 1 {
@@ -537,7 +537,7 @@ pub enum Compilation {
537
537
Continue ,
538
538
}
539
539
540
- fn handle_explain( handler: & EarlyErrorHandler , registry: Registry , code: & str , color: ColorConfig ) {
540
+ fn handle_explain( handler: & EarlyDiagCtxt , registry: Registry , code: & str , color: ColorConfig ) {
541
541
let upper_cased_code = code. to_ascii_uppercase( ) ;
542
542
let normalised =
543
543
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) {
669
669
}
670
670
}
671
671
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 ) {
677
673
match sess. io. input {
678
674
Input :: File ( ref ifile) => {
679
675
let path = & ( * ifile) ;
@@ -695,7 +691,7 @@ fn list_metadata(
695
691
}
696
692
697
693
fn print_crate_info(
698
- handler: & EarlyErrorHandler ,
694
+ handler: & EarlyDiagCtxt ,
699
695
codegen_backend: & dyn CodegenBackend ,
700
696
sess: & Session ,
701
697
parse_attrs: bool ,
@@ -873,7 +869,7 @@ pub macro version($handler: expr, $binary: literal, $matches: expr) {
873
869
874
870
#[ doc( hidden) ] // use the macro instead
875
871
pub fn version_at_macro_invocation(
876
- handler: & EarlyErrorHandler ,
872
+ handler: & EarlyDiagCtxt ,
877
873
binary: & str ,
878
874
matches: & getopts:: Matches ,
879
875
version: & str ,
@@ -1072,7 +1068,7 @@ Available lint options:
1072
1068
/// Show help for flag categories shared between rustdoc and rustc.
1073
1069
///
1074
1070
/// 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 {
1076
1072
// Handle the special case of -Wall.
1077
1073
let wall = matches. opt_strs( "W" ) ;
1078
1074
if wall. iter( ) . any( |x| * x == "all" ) {
@@ -1160,7 +1156,7 @@ fn print_flag_list<T>(
1160
1156
/// This does not need to be `pub` for rustc itself, but @chaosite needs it to
1161
1157
/// be public when using rustc as a library, see
1162
1158
/// <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 > {
1164
1160
if args. is_empty( ) {
1165
1161
// user did not write `-v` nor `-Z unstable-options`, so do not
1166
1162
// include that extra information.
@@ -1336,7 +1332,7 @@ pub fn install_ice_hook(
1336
1332
if msg. starts_with( "failed printing to stdout: " ) && msg. ends_with( "(os error 232)" )
1337
1333
{
1338
1334
// 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 ( ) ) ;
1340
1336
let _ = handler. early_error_no_abort( msg. clone( ) ) ;
1341
1337
return ;
1342
1338
}
@@ -1476,14 +1472,14 @@ fn report_ice(
1476
1472
1477
1473
/// This allows tools to enable rust logging without having to magically match rustc's
1478
1474
/// tracing crate version.
1479
- pub fn init_rustc_env_logger( handler: & EarlyErrorHandler ) {
1475
+ pub fn init_rustc_env_logger( handler: & EarlyDiagCtxt ) {
1480
1476
init_logger( handler, rustc_log:: LoggerConfig :: from_env( "RUSTC_LOG" ) ) ;
1481
1477
}
1482
1478
1483
1479
/// This allows tools to enable rust logging without having to magically match rustc's
1484
1480
/// tracing crate version. In contrast to `init_rustc_env_logger` it allows you to choose
1485
1481
/// 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 ) {
1487
1483
if let Err ( error) = rustc_log:: init_logger( cfg) {
1488
1484
handler. early_error( error. to_string( ) ) ;
1489
1485
}
@@ -1493,7 +1489,7 @@ pub fn main() -> ! {
1493
1489
let start_time = Instant :: now( ) ;
1494
1490
let start_rss = get_resident_set_size( ) ;
1495
1491
1496
- let handler = EarlyErrorHandler :: new( ErrorOutputType :: default ( ) ) ;
1492
+ let handler = EarlyDiagCtxt :: new( ErrorOutputType :: default ( ) ) ;
1497
1493
1498
1494
init_rustc_env_logger( & handler) ;
1499
1495
signal_handler:: install( ) ;
0 commit comments