@@ -228,6 +228,7 @@ use rustc_session::filesearch::FileSearch;
228
228
use rustc_session:: search_paths:: PathKind ;
229
229
use rustc_session:: utils:: CanonicalizedPath ;
230
230
use rustc_session:: Session ;
231
+ use rustc_span:: sym;
231
232
use rustc_span:: symbol:: Symbol ;
232
233
use rustc_span:: Span ;
233
234
use rustc_target:: spec:: { Target , TargetTriple } ;
@@ -1077,7 +1078,7 @@ impl CrateError {
1077
1078
crate_rejections,
1078
1079
} ) ;
1079
1080
} else {
1080
- dcx . emit_err ( errors:: CannotFindCrate {
1081
+ let error = errors:: CannotFindCrate {
1081
1082
span,
1082
1083
crate_name,
1083
1084
add_info,
@@ -1091,11 +1092,18 @@ impl CrateError {
1091
1092
profiler_runtime : Symbol :: intern ( & sess. opts . unstable_opts . profiler_runtime ) ,
1092
1093
locator_triple : locator. triple ,
1093
1094
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
+ }
1095
1103
}
1096
1104
}
1097
1105
CrateError :: NotFound ( crate_name) => {
1098
- dcx . emit_err ( errors:: CannotFindCrate {
1106
+ let error = errors:: CannotFindCrate {
1099
1107
span,
1100
1108
crate_name,
1101
1109
add_info : String :: new ( ) ,
@@ -1105,7 +1113,14 @@ impl CrateError {
1105
1113
profiler_runtime : Symbol :: intern ( & sess. opts . unstable_opts . profiler_runtime ) ,
1106
1114
locator_triple : sess. opts . target_triple . clone ( ) ,
1107
1115
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
+ }
1109
1124
}
1110
1125
}
1111
1126
}
0 commit comments