Skip to content

Commit

Permalink
Add directive keywords to error message for parsing global item (#6723)
Browse files Browse the repository at this point in the history
Notify the user that they can also use `diagnostic`, `enable`, or
`requires` in this context.

Co-authored-by: Erich Gubler <[email protected]>
  • Loading branch information
e-hat and ErichDonGubler authored Jan 8, 2025
1 parent eeb79f3 commit 1f67474
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion naga/src/front/wgsl/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 1f67474

Please sign in to comment.