Skip to content

Commit 12d0b64

Browse files
committed
Make not finding core a fatal error
1 parent da02fff commit 12d0b64

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

compiler/rustc_metadata/src/locator.rs

+18-4
Original file line numberDiff line numberDiff line change
@@ -1077,7 +1077,7 @@ impl CrateError {
10771077
crate_rejections,
10781078
});
10791079
} else {
1080-
dcx.emit_err(errors::CannotFindCrate {
1080+
let error = errors::CannotFindCrate {
10811081
span,
10821082
crate_name,
10831083
add_info,
@@ -1091,11 +1091,18 @@ impl CrateError {
10911091
profiler_runtime: Symbol::intern(&sess.opts.unstable_opts.profiler_runtime),
10921092
locator_triple: locator.triple,
10931093
is_ui_testing: sess.opts.unstable_opts.ui_testing,
1094-
});
1094+
};
1095+
// The diagnostic for missing core is very good, but it is followed by a lot of
1096+
// other diagnostics that do not add information.
1097+
if missing_core {
1098+
dcx.emit_fatal(error);
1099+
} else {
1100+
dcx.emit_err(error);
1101+
}
10951102
}
10961103
}
10971104
CrateError::NotFound(crate_name) => {
1098-
dcx.emit_err(errors::CannotFindCrate {
1105+
let error = errors::CannotFindCrate {
10991106
span,
11001107
crate_name,
11011108
add_info: String::new(),
@@ -1105,7 +1112,14 @@ impl CrateError {
11051112
profiler_runtime: Symbol::intern(&sess.opts.unstable_opts.profiler_runtime),
11061113
locator_triple: sess.opts.target_triple.clone(),
11071114
is_ui_testing: sess.opts.unstable_opts.ui_testing,
1108-
});
1115+
};
1116+
// The diagnostic for missing core is very good, but it is followed by a lot of
1117+
// other diagnostics that do not add information.
1118+
if missing_core {
1119+
dcx.emit_fatal(error);
1120+
} else {
1121+
dcx.emit_err(error);
1122+
}
11091123
}
11101124
}
11111125
}

0 commit comments

Comments
 (0)