1
Fork 0

Rollup merge of #124333 - Urgau:better-bad-print, r=fmease

Improve diagnostic for unknown `--print` request

This PR improves the diagnostic when encountering a unknown `--print` request.

It also moves the run-make test to a simple UI test.
This commit is contained in:
Matthias Krüger 2024-04-25 00:19:55 +02:00 committed by GitHub
commit f46b828b55
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 11 additions and 10 deletions

View file

@ -1888,9 +1888,12 @@ fn collect_print_requests(
let prints =
PRINT_KINDS.iter().map(|(name, _)| format!("`{name}`")).collect::<Vec<_>>();
let prints = prints.join(", ");
early_dcx.early_fatal(format!(
"unknown print request `{req}`. Valid print requests are: {prints}"
));
let mut diag =
early_dcx.early_struct_fatal(format!("unknown print request: `{req}`"));
#[allow(rustc::diagnostic_outside_of_impl)]
diag.help(format!("valid print requests are: {prints}"));
diag.emit()
}
};