@@ -228,6 +228,7 @@ use rustc_session::filesearch::FileSearch;
228228use rustc_session:: search_paths:: PathKind ;
229229use rustc_session:: utils:: CanonicalizedPath ;
230230use rustc_session:: Session ;
231+ use rustc_span:: sym;
231232use rustc_span:: symbol:: Symbol ;
232233use rustc_span:: Span ;
233234use rustc_target:: spec:: { Target , TargetTriple } ;
@@ -1077,7 +1078,7 @@ impl CrateError {
10771078 crate_rejections,
10781079 } ) ;
10791080 } else {
1080- dcx . emit_err ( errors:: CannotFindCrate {
1081+ let error = errors:: CannotFindCrate {
10811082 span,
10821083 crate_name,
10831084 add_info,
@@ -1091,11 +1092,18 @@ impl CrateError {
10911092 profiler_runtime : Symbol :: intern ( & sess. opts . unstable_opts . profiler_runtime ) ,
10921093 locator_triple : locator. triple ,
10931094 is_ui_testing : sess. opts . unstable_opts . ui_testing ,
1094- } ) ;
1095+ } ;
1096+ // The diagnostic for missing core is very good, but it is followed by a lot of
1097+ // other diagnostics that do not add information.
1098+ if missing_core {
1099+ dcx. emit_fatal ( error) ;
1100+ } else {
1101+ dcx. emit_err ( error) ;
1102+ }
10951103 }
10961104 }
10971105 CrateError :: NotFound ( crate_name) => {
1098- dcx . emit_err ( errors:: CannotFindCrate {
1106+ let error = errors:: CannotFindCrate {
10991107 span,
11001108 crate_name,
11011109 add_info : String :: new ( ) ,
@@ -1105,7 +1113,14 @@ impl CrateError {
11051113 profiler_runtime : Symbol :: intern ( & sess. opts . unstable_opts . profiler_runtime ) ,
11061114 locator_triple : sess. opts . target_triple . clone ( ) ,
11071115 is_ui_testing : sess. opts . unstable_opts . ui_testing ,
1108- } ) ;
1116+ } ;
1117+ // The diagnostic for missing core is very good, but it is followed by a lot of
1118+ // other diagnostics that do not add information.
1119+ if missing_core {
1120+ dcx. emit_fatal ( error) ;
1121+ } else {
1122+ dcx. emit_err ( error) ;
1123+ }
11091124 }
11101125 }
11111126 }
0 commit comments