I stumbled upon this error while using spirv-std-0.10.0-alpha.1 from crates-io with cargo-gpu from crates-io as well (same version). I thought I'll report it, to safe others the search for a solution 🙂 .
I got a lot of those errors when using cargo gpu build:
error: unknown `rust_gpu` attribute, expected `rust_gpu::spirv_v0_9`. Do the versions of `spirv-std` and `rustc_codegen_spirv` match?
--> /home/../src/index.crates.io-1949cf8c6b5b557f/spirv-std-0.10.0-alpha.1/src/sampler.rs:3:1
|
3 | #[spirv(sampler)]
| ^^^^^^^^^^^^^^^^^
|
= note: this error originates in the attribute macro `spirv` (in Nightly builds, run with -Z macro-backtrace for more info)
As the error suggests, I checked my spirv-std an cargo-gpu versions, via
cargo tree | grep "spriv-std" -> All are at 0.10.0-alpha.1
cargo gpu --version -> 0.10.0-alpha.1 (assuming that this will use the correct rustc_codegen_spirv version)
Solution
The real problem was, that I forgot to exclude the shader crate in the workspace. This seems to mess with the rustc_codegen_spirv version. Once I added it to the exclude list, I could build the shader again.
I stumbled upon this error while using
spirv-std-0.10.0-alpha.1from crates-io with cargo-gpu from crates-io as well (same version). I thought I'll report it, to safe others the search for a solution 🙂 .I got a lot of those errors when using
cargo gpu build:As the error suggests, I checked my
spirv-stdancargo-gpuversions, viacargo tree | grep "spriv-std"-> All are at 0.10.0-alpha.1cargo gpu --version-> 0.10.0-alpha.1 (assuming that this will use the correctrustc_codegen_spirvversion)Solution
The real problem was, that I forgot to exclude the shader crate in the workspace. This seems to mess with the
rustc_codegen_spirvversion. Once I added it to theexcludelist, I could build the shader again.