Skip to content

Commit 8078fb5

Browse files
authored
fix: remove unexpected cfg(feature = "validation") from generated tests (#103)
The __validate_wgsl test generated by #[wgsl] for modules with imports was gated on cfg(all(test, feature = "validation")), but the "validation" feature belongs to the wgsl-rs crate, not the consuming crate. This produced an 'unexpected cfg condition value' warning in downstream crates. Change to cfg(test) only — the validate() method availability is already controlled by wgsl-rs feature flags.
1 parent 128aba1 commit 8078fb5

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

  • crates/wgsl-rs-macros/src

crates/wgsl-rs-macros/src/lib.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,15 @@ fn gen_wgsl_module(
268268
///
269269
/// This is used for modules that have imports, which cannot be validated at
270270
/// compile-time because the imported symbols aren't available during macro
271-
/// expansion.
271+
/// expansion. The `validate()` method is available on `Module` when the
272+
/// `wgsl-rs` crate has the `validation` feature enabled (the default). We
273+
/// gate on `#[cfg(test)]` only — not `feature = "validation"` — because the
274+
/// feature belongs to `wgsl-rs`, not the consuming crate, and checking it
275+
/// here would produce an "unexpected cfg" warning in downstream crates.
272276
fn gen_validation_test(module_ident: &syn::Ident) -> proc_macro2::TokenStream {
273277
let error_msg = format!("WGSL validation failed for module '{module_ident}'");
274278
quote! {
275-
#[cfg(all(test, feature = "validation"))]
279+
#[cfg(test)]
276280
#[test]
277281
fn __validate_wgsl() {
278282
WGSL_MODULE.validate().expect(#error_msg);

0 commit comments

Comments
 (0)