Skip to content

Commit 28b8c9a

Browse files
committed
Panic on unreachable code
1 parent 918ddf1 commit 28b8c9a

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

naga/src/back/hlsl/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,8 +471,6 @@ pub enum Error {
471471
ResolveArraySizeError(#[from] proc::ResolveArraySizeError),
472472
#[error("entry point with stage {0:?} and name '{1}' not found")]
473473
EntryPointNotFound(ir::ShaderStage, String),
474-
#[error("Internal error: reached unreachable code: {0}")]
475-
Unreachable(String),
476474
}
477475

478476
#[derive(PartialEq, Eq, Hash)]

naga/src/back/hlsl/storage.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,7 @@ impl<W: fmt::Write> super::Writer<'_, W> {
343343
&temp_resolution
344344
}
345345
StoreValue::TempColumnAccess { .. } => {
346-
return Err(Error::Unreachable(
347-
"attempting write_storage_store for TempColumnAccess".into(),
348-
));
346+
unreachable!("attempting write_storage_store for TempColumnAccess");
349347
}
350348
};
351349
match *ty_resolution.inner_with(&module.types) {
@@ -409,9 +407,9 @@ impl<W: fmt::Write> super::Writer<'_, W> {
409407
// working around the borrow checker in `self.write_expr`
410408
let var_name = &self.names[&NameKey::GlobalVariable(var_handle)];
411409
let StoreValue::TempAccess { member_index, .. } = value else {
412-
return Err(Error::Unreachable(
413-
"write_storage_store within_struct but not TempAccess".into(),
414-
));
410+
unreachable!(
411+
"write_storage_store within_struct but not TempAccess"
412+
);
415413
};
416414
let column_value = StoreValue::TempColumnAccess {
417415
depth: level.0, // note not incrementing, b/c no temp

0 commit comments

Comments
 (0)