feat: #[wgsl_ignore]#106
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a new #[wgsl_ignore] attribute to the wgsl-rs macro surface so users can keep Rust-only items inside #[wgsl] modules without generating WGSL for them. It extends the public re-exports and adds parser-side support to skip annotated module items during WGSL generation.
Changes:
- Re-export
wgsl_ignorefromwgsl-rsandwgsl_rs::stdso it is available to downstream users. - Add parser logic in
wgsl-rs-macrosto detect#[wgsl_ignore]on module items and omit those items from generated WGSL. - Add an example module demonstrating a Rust-only constant annotated with
#[wgsl_ignore].
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
crates/wgsl-rs/src/std.rs |
Re-exports wgsl_ignore through the std prelude used in #[wgsl] modules. |
crates/wgsl-rs/src/lib.rs |
Re-exports wgsl_ignore from the crate root for downstream use. |
crates/wgsl-rs-macros/src/parse.rs |
Adds detection of #[wgsl_ignore] and skips annotated module items during WGSL parsing. |
crates/wgsl-rs-macros/src/lib.rs |
Defines the wgsl_ignore proc-macro attribute and documents intended behavior. |
crates/example/src/examples.rs |
Adds a small example showing a Rust-only item ignored by WGSL generation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
schell
added a commit
that referenced
this pull request
May 29, 2026
* feat: #[wgsl_ignore] * warnings * better way to wgsl_ignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These changes add a
#[wgsl_ignore]attribute that can be placed on any module item. An item with this annotation is ignored by the parser and WGSL code gen. It passes through on the Rust side.This is a feature needed by frameworks looking to add linkage and other Rust-side only features to their WGSL modules.
Requested in: