From 1f674741403b7b9780297ad3f7b78e86731fefe3 Mon Sep 17 00:00:00 2001 From: Eddie Hatfield Date: Wed, 8 Jan 2025 11:24:03 -0500 Subject: [PATCH] Add directive keywords to error message for parsing global item (#6723) Notify the user that they can also use `diagnostic`, `enable`, or `requires` in this context. Co-authored-by: Erich Gubler --- CHANGELOG.md | 1 + naga/src/front/wgsl/error.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c919e78bd6..2fb25834a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -171,6 +171,7 @@ By @wumpf in [#6849](https://github.com/gfx-rs/wgpu/pull/6849). - The GLSL parser now uses less expressions for function calls. By @magcius in [#6604](https://github.com/gfx-rs/wgpu/pull/6604). - Add a note to help with a common syntax error case for global diagnostic filter directives. By @e-hat in [#6718](https://github.com/gfx-rs/wgpu/pull/6718) - Change arithmetic operations between two i32 variables to wrap on overflow to match WGSL spec. By @matthew-wong1 in [#6835](https://github.com/gfx-rs/wgpu/pull/6835). +- Add directives to suggestions in error message for parsing global items. By @e-hat in [#6723](https://github.com/gfx-rs/wgpu/pull/6723). ##### General diff --git a/naga/src/front/wgsl/error.rs b/naga/src/front/wgsl/error.rs index 28b908261a..8b1e4f354f 100644 --- a/naga/src/front/wgsl/error.rs +++ b/naga/src/front/wgsl/error.rs @@ -390,7 +390,7 @@ impl<'a> Error<'a> { "workgroup size separator (',') or a closing parenthesis".to_string() } ExpectedToken::GlobalItem => concat!( - "global item ('struct', 'const', 'var', 'alias', ';', 'fn') ", + "global item ('struct', 'const', 'var', 'alias', 'fn', 'diagnostic', 'enable', 'requires', ';') ", "or the end of the file" ) .to_string(),