Skip to content

wgpu-types error when using serde feature without tracing feature #3609

Closed
@paul-hansen

Description

@paul-hansen

Description
The wgpu-types crate returns an error if compiled with the "serde" feature and not the trace feature.

Repro steps

cargo test --package wgpu-types --features serde

Expected vs observed behavior
I was expecting it to compile with serde serialization and deserialization of common structs.
Instead it returned many instances of this compile time error :

error: cannot find attribute `serde` in this scope                                                                                                                                                
   --> wgpu-types\src\lib.rs:123:31
    |
123 | #[cfg_attr(feature = "serde", serde(rename_all = "kebab-case"))]
    |                               ^^^^^
    |
    = note: `serde` is in scope, but it is a crate, not an attribute

Platform

  • Windows 11
  • wgpu master branch, commit 7495646d

Addition Info
My use case was trying to load image sampler settings from a file so I can set the texture to be repeating in Bevy. Some of wgpu's types are exposed by Bevy so I thought I would try turning on serde support to be able to load those values from a file directly. This isn't really a big deal for me, but I thought you might want to know about the inconsistency in the features.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: apiIssues related to API surfacetype: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions