diff --git a/src/front/glsl/error.rs b/src/front/glsl/error.rs index 0e839b2b99..f1fcc3a72e 100644 --- a/src/front/glsl/error.rs +++ b/src/front/glsl/error.rs @@ -33,8 +33,8 @@ pub enum ErrorKind { #[error("Unknown layout qualifier: {1}")] UnknownLayoutQualifier(SourceMetadata, String), #[cfg(feature = "glsl-validate")] - #[error("Variable already declared: {0}")] - VariableAlreadyDeclared(String), + #[error("Variable already declared: {1}")] + VariableAlreadyDeclared(SourceMetadata, String), #[error("{1}")] SemanticError(SourceMetadata, Cow<'static, str>), } @@ -48,7 +48,8 @@ impl ErrorKind { | ErrorKind::InvalidVersion(metadata, _) | ErrorKind::UnknownLayoutQualifier(metadata, _) | ErrorKind::SemanticError(metadata, _) - | ErrorKind::UnknownField(metadata, _) => Some(metadata), + | ErrorKind::UnknownField(metadata, _) + | ErrorKind::VariableAlreadyDeclared(metadata, _) => Some(metadata), ErrorKind::InvalidToken(ref token, _) => Some(token.meta), _ => None, } diff --git a/src/front/glsl/variables.rs b/src/front/glsl/variables.rs index 8a3bbee5dd..168ff3ea2f 100644 --- a/src/front/glsl/variables.rs +++ b/src/front/glsl/variables.rs @@ -389,7 +389,7 @@ impl Program<'_> { ) -> Result, ErrorKind> { #[cfg(feature = "glsl-validate")] if ctx.lookup_local_var_current_scope(&name).is_some() { - return Err(ErrorKind::VariableAlreadyDeclared(name)); + return Err(ErrorKind::VariableAlreadyDeclared(meta, name)); } let mut mutable = true;