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 7e24911
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions compiler/rustc_metadata/src/locator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ use rustc_session::filesearch::FileSearch;
use rustc_session::search_paths::PathKind;
use rustc_session::utils::CanonicalizedPath;
use rustc_session::Session;
use rustc_span::sym;
use rustc_span::symbol::Symbol;
use rustc_span::Span;
use rustc_target::spec::{Target, TargetTriple};
Expand Down Expand Up @@ -1077,7 +1078,7 @@ impl CrateError {
crate_rejections,
});
} else {
dcx.emit_err(errors::CannotFindCrate {
let error = errors::CannotFindCrate {
span,
crate_name,
add_info,
Expand All @@ -1091,11 +1092,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 +1113,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 7e24911

Please sign in to comment.