Skip to content

Commit

Permalink
Make not finding core a fatal error
Browse files Browse the repository at this point in the history
  • Loading branch information
saethlin committed Mar 6, 2024
1 parent da02fff commit 12d0b64
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions compiler/rustc_metadata/src/locator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,7 @@ impl CrateError {
crate_rejections,
});
} else {
dcx.emit_err(errors::CannotFindCrate {
let error = errors::CannotFindCrate {
span,
crate_name,
add_info,
Expand All @@ -1091,11 +1091,18 @@ impl CrateError {
profiler_runtime: Symbol::intern(&sess.opts.unstable_opts.profiler_runtime),
locator_triple: locator.triple,
is_ui_testing: sess.opts.unstable_opts.ui_testing,
});
};
// The diagnostic for missing core is very good, but it is followed by a lot of
// other diagnostics that do not add information.
if missing_core {
dcx.emit_fatal(error);
} else {
dcx.emit_err(error);
}
}
}
CrateError::NotFound(crate_name) => {
dcx.emit_err(errors::CannotFindCrate {
let error = errors::CannotFindCrate {
span,
crate_name,
add_info: String::new(),
Expand All @@ -1105,7 +1112,14 @@ impl CrateError {
profiler_runtime: Symbol::intern(&sess.opts.unstable_opts.profiler_runtime),
locator_triple: sess.opts.target_triple.clone(),
is_ui_testing: sess.opts.unstable_opts.ui_testing,
});
};
// The diagnostic for missing core is very good, but it is followed by a lot of
// other diagnostics that do not add information.
if missing_core {
dcx.emit_fatal(error);
} else {
dcx.emit_err(error);
}
}
}
}
Expand Down

0 comments on commit 12d0b64

Please sign in to comment.