[naga] Remove ExpressionError::DoesntExist.

Remove `valid::expression::ExpressionError::DoesntExist`. This error is reported
when expression validation encounters an invalid `Handle<Expression>`, but we
have already verified that the module is free of invalid handles in
`Validator::validate_module_handles`, so this condition should never arise.
This commit is contained in:
Jim Blandy 2024-05-31 16:14:16 -07:00 committed by Teodor Tanasoaia
parent 91e4be314c
commit 049db89039
2 changed files with 2 additions and 13 deletions

View File

@ -12,8 +12,6 @@ use crate::{
#[derive(Clone, Debug, thiserror::Error)]
#[cfg_attr(test, derive(PartialEq))]
pub enum ExpressionError {
#[error("Doesn't exist")]
DoesntExist,
#[error("Used by a statement before it was introduced into the scope by any of the dominating blocks")]
NotInScope,
#[error("Base type {0:?} is not compatible with this expression")]

View File

@ -241,9 +241,7 @@ impl<'a> BlockContext<'a> {
handle: Handle<crate::Expression>,
valid_expressions: &BitSet,
) -> Result<&crate::TypeInner, WithSpan<ExpressionError>> {
if handle.index() >= self.expressions.len() {
Err(ExpressionError::DoesntExist.with_span())
} else if !valid_expressions.contains(handle.index()) {
if !valid_expressions.contains(handle.index()) {
Err(ExpressionError::NotInScope.with_span_handle(handle, self.expressions))
} else {
Ok(self.info[handle].ty.inner_with(self.types))
@ -263,14 +261,7 @@ impl<'a> BlockContext<'a> {
&self,
handle: Handle<crate::Expression>,
) -> Result<&crate::TypeInner, FunctionError> {
if handle.index() >= self.expressions.len() {
Err(FunctionError::Expression {
handle,
source: ExpressionError::DoesntExist,
})
} else {
Ok(self.info[handle].ty.inner_with(self.types))
}
Ok(self.info[handle].ty.inner_with(self.types))
}
}