mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 08:13:27 +00:00
[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:
parent
91e4be314c
commit
049db89039
@ -12,8 +12,6 @@ use crate::{
|
|||||||
#[derive(Clone, Debug, thiserror::Error)]
|
#[derive(Clone, Debug, thiserror::Error)]
|
||||||
#[cfg_attr(test, derive(PartialEq))]
|
#[cfg_attr(test, derive(PartialEq))]
|
||||||
pub enum ExpressionError {
|
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")]
|
#[error("Used by a statement before it was introduced into the scope by any of the dominating blocks")]
|
||||||
NotInScope,
|
NotInScope,
|
||||||
#[error("Base type {0:?} is not compatible with this expression")]
|
#[error("Base type {0:?} is not compatible with this expression")]
|
||||||
|
@ -241,9 +241,7 @@ impl<'a> BlockContext<'a> {
|
|||||||
handle: Handle<crate::Expression>,
|
handle: Handle<crate::Expression>,
|
||||||
valid_expressions: &BitSet,
|
valid_expressions: &BitSet,
|
||||||
) -> Result<&crate::TypeInner, WithSpan<ExpressionError>> {
|
) -> Result<&crate::TypeInner, WithSpan<ExpressionError>> {
|
||||||
if handle.index() >= self.expressions.len() {
|
if !valid_expressions.contains(handle.index()) {
|
||||||
Err(ExpressionError::DoesntExist.with_span())
|
|
||||||
} else if !valid_expressions.contains(handle.index()) {
|
|
||||||
Err(ExpressionError::NotInScope.with_span_handle(handle, self.expressions))
|
Err(ExpressionError::NotInScope.with_span_handle(handle, self.expressions))
|
||||||
} else {
|
} else {
|
||||||
Ok(self.info[handle].ty.inner_with(self.types))
|
Ok(self.info[handle].ty.inner_with(self.types))
|
||||||
@ -263,14 +261,7 @@ impl<'a> BlockContext<'a> {
|
|||||||
&self,
|
&self,
|
||||||
handle: Handle<crate::Expression>,
|
handle: Handle<crate::Expression>,
|
||||||
) -> Result<&crate::TypeInner, FunctionError> {
|
) -> Result<&crate::TypeInner, FunctionError> {
|
||||||
if handle.index() >= self.expressions.len() {
|
Ok(self.info[handle].ty.inner_with(self.types))
|
||||||
Err(FunctionError::Expression {
|
|
||||||
handle,
|
|
||||||
source: ExpressionError::DoesntExist,
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
Ok(self.info[handle].ty.inner_with(self.types))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user