mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Clean up naga's xtask a bit (#7014)
This commit is contained in:
@@ -16,7 +16,6 @@ mod glob;
|
||||
mod jobserver;
|
||||
mod path;
|
||||
mod process;
|
||||
mod result;
|
||||
mod validate;
|
||||
|
||||
fn main() -> ExitCode {
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub(crate) enum ErrorStatus {
|
||||
NoFailuresFound,
|
||||
OneOrMoreFailuresFound,
|
||||
}
|
||||
|
||||
impl ErrorStatus {
|
||||
pub(crate) fn merge(self, other: Self) -> Self {
|
||||
match (self, other) {
|
||||
(Self::OneOrMoreFailuresFound, _) | (_, Self::OneOrMoreFailuresFound) => {
|
||||
Self::OneOrMoreFailuresFound
|
||||
}
|
||||
(Self::NoFailuresFound, Self::NoFailuresFound) => Self::NoFailuresFound,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) trait LogIfError<T> {
|
||||
fn log_if_err_found(self, status: &mut ErrorStatus) -> Option<T>;
|
||||
}
|
||||
|
||||
impl<T> LogIfError<T> for anyhow::Result<T> {
|
||||
fn log_if_err_found(self, status: &mut ErrorStatus) -> Option<T> {
|
||||
match self {
|
||||
Ok(t) => Some(t),
|
||||
Err(e) => {
|
||||
log::error!("{e:?}");
|
||||
*status = status.merge(ErrorStatus::OneOrMoreFailuresFound);
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ pub(crate) fn validate(cmd: ValidateSubcommand) -> anyhow::Result<()> {
|
||||
for job in jobs {
|
||||
let tx_results = tx_results.clone();
|
||||
crate::jobserver::start_job_thread(move || {
|
||||
let result = match std::panic::catch_unwind(|| job()) {
|
||||
let result = match std::panic::catch_unwind(job) {
|
||||
Ok(result) => result,
|
||||
Err(payload) => Err(match payload.downcast_ref::<&str>() {
|
||||
Some(message) => {
|
||||
|
||||
Reference in New Issue
Block a user