@@ -965,7 +965,6 @@ fn default_emitter(
965965#[ allow( rustc:: bad_opt_access) ]
966966#[ allow( rustc:: untranslatable_diagnostic) ] // FIXME: make this translatable
967967pub fn build_session (
968- early_dcx : EarlyDiagCtxt ,
969968 sopts : config:: Options ,
970969 io : CompilerIO ,
971970 bundle : Option < Arc < rustc_errors:: FluentBundle > > ,
@@ -990,14 +989,6 @@ pub fn build_session(
990989 let cap_lints_allow = sopts. lint_cap . is_some_and ( |cap| cap == lint:: Allow ) ;
991990 let can_emit_warnings = !( warnings_allow || cap_lints_allow) ;
992991
993- let host_triple = TargetTuple :: from_tuple ( config:: host_tuple ( ) ) ;
994- let ( host, target_warnings) = Target :: search ( & host_triple, & sysroot) . unwrap_or_else ( |e| {
995- early_dcx. early_fatal ( format ! ( "Error loading host specification: {e}" ) )
996- } ) ;
997- for warning in target_warnings. warning_messages ( ) {
998- early_dcx. early_warn ( warning)
999- }
1000-
1001992 let fallback_bundle = fallback_fluent_bundle (
1002993 fluent_resources,
1003994 sopts. unstable_opts . translate_directionality_markers ,
@@ -1012,9 +1003,12 @@ pub fn build_session(
10121003 dcx = dcx. with_ice_file ( ice_file) ;
10131004 }
10141005
1015- // Now that the proper handler has been constructed, drop early_dcx to
1016- // prevent accidental use.
1017- drop ( early_dcx) ;
1006+ let host_triple = TargetTuple :: from_tuple ( config:: host_tuple ( ) ) ;
1007+ let ( host, target_warnings) = Target :: search ( & host_triple, & sysroot)
1008+ . unwrap_or_else ( |e| dcx. handle ( ) . fatal ( format ! ( "Error loading host specification: {e}" ) ) ) ;
1009+ for warning in target_warnings. warning_messages ( ) {
1010+ dcx. handle ( ) . warn ( warning)
1011+ }
10181012
10191013 let self_profiler = if let SwitchWithOptPath :: Enabled ( ref d) = sopts. unstable_opts . self_profile
10201014 {
0 commit comments