Remove all threading through of ErrorGuaranteed from the driver

It was inconsistently done (sometimes even within a single function) and
most of the rest of the compiler uses fatal errors instead, which need
to be caught using catch_with_exit_code anyway. Using fatal errors
instead of ErrorGuaranteed everywhere in the driver simplifies things a
bit.
This commit is contained in:
bjorn3
2024-11-03 16:45:22 +00:00
parent 030545d8c3
commit 401dd840ff
19 changed files with 175 additions and 216 deletions

View File

@@ -99,10 +99,7 @@ impl Expander {
/// If this function is intended to be used with command line arguments,
/// `argv[0]` must be removed prior to calling it manually.
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
pub fn arg_expand_all(
early_dcx: &EarlyDiagCtxt,
at_args: &[String],
) -> Result<Vec<String>, ErrorGuaranteed> {
pub fn arg_expand_all(early_dcx: &EarlyDiagCtxt, at_args: &[String]) -> Vec<String> {
let mut expander = Expander::default();
let mut result = Ok(());
for arg in at_args {
@@ -110,7 +107,10 @@ pub fn arg_expand_all(
result = Err(early_dcx.early_err(format!("failed to load argument file: {err}")));
}
}
result.map(|()| expander.finish())
if let Err(guar) = result {
guar.raise_fatal();
}
expander.finish()
}
/// Gets the raw unprocessed command-line arguments as Unicode strings, without doing any further