@@ -367,18 +367,17 @@ fn run_compiler(
367367 return early_exit();
368368 }
369369
370- let early_dcx = EarlyDiagCtxt::new(sess.opts.error_format);
371-
372- if print_crate_info(&early_dcx, codegen_backend, sess, has_input) == Compilation::Stop {
370+ if print_crate_info(codegen_backend, sess, has_input) == Compilation::Stop {
373371 return early_exit();
374372 }
375373
376374 if !has_input {
377- early_dcx.early_fatal("no input filename given"); // this is fatal
375+ #[allow(rustc::diagnostic_outside_of_impl)]
376+ sess.dcx().fatal("no input filename given"); // this is fatal
378377 }
379378
380379 if !sess.opts.unstable_opts.ls.is_empty() {
381- list_metadata(&early_dcx, sess, &*codegen_backend.metadata_loader());
380+ list_metadata(sess, &*codegen_backend.metadata_loader());
382381 return early_exit();
383382 }
384383
@@ -674,7 +673,7 @@ fn process_rlink(sess: &Session, compiler: &interface::Compiler) {
674673 }
675674}
676675
677- fn list_metadata(early_dcx: &EarlyDiagCtxt, sess: &Session, metadata_loader: &dyn MetadataLoader) {
676+ fn list_metadata(sess: &Session, metadata_loader: &dyn MetadataLoader) {
678677 match sess.io.input {
679678 Input::File(ref ifile) => {
680679 let path = &(*ifile);
@@ -691,13 +690,13 @@ fn list_metadata(early_dcx: &EarlyDiagCtxt, sess: &Session, metadata_loader: &dy
691690 safe_println!("{}", String::from_utf8(v).unwrap());
692691 }
693692 Input::Str { .. } => {
694- early_dcx.early_fatal("cannot list metadata for stdin");
693+ #[allow(rustc::diagnostic_outside_of_impl)]
694+ sess.dcx().fatal("cannot list metadata for stdin");
695695 }
696696 }
697697}
698698
699699fn print_crate_info(
700- early_dcx: &EarlyDiagCtxt,
701700 codegen_backend: &dyn CodegenBackend,
702701 sess: &Session,
703702 parse_attrs: bool,
@@ -881,8 +880,8 @@ fn print_crate_info(
881880 .expect("unknown Apple target OS");
882881 println_info!("deployment_target={}", format!("{major}.{minor}"))
883882 } else {
884- early_dcx
885- .early_fatal ("only Apple targets currently support deployment version info")
883+ #[allow(rustc::diagnostic_outside_of_impl)]
884+ sess.dcx().fatal ("only Apple targets currently support deployment version info")
886885 }
887886 }
888887 }
0 commit comments