Skip to content

mainpage example #627

Closed
Rust-GPU/rust-gpu.github.io
#97

Description

@fengints

https://rust-gpu.github.io/
example in main page. Compile error

stable rust, rustc 1.96.0 (ac68faa20 2026-05-25)

error[E0580]: `main` function has wrong type
  --> src/main.rs:26:1
   |
26 | #[spirv(compute(threads(64)))]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
   |
   = note: expected signature `fn()`
              found signature `for<'a> fn(glam::UVec3, &'a mut [Option<Outcome>; 64])`

error[E0277]: the type `[Option<Outcome>]` cannot be indexed by `u32`
   --> src/main.rs:32:12
    |
 32 |     output[index] = index.fizzbuz...
    |            ^^^^^ slice indices are of type `usize` or ranges of `usize`
    |
    = help: the trait `SliceIndex<[Option<Outcome>]>` is not implemented for `u32`
help: `usize` implements trait `SliceIndex<T>`
   --> /.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/index.rs:214:1
    |
214 | unsafe impl<T> const SliceIndex<[T]> for usize {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SliceIndex<[T]>`
    |
   ::: /stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/bstr/traits.rs:197:1
    |
197 | unsafe impl SliceIndex<ByteStr> for usize {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SliceIndex<ByteStr>`
    = note: required for `[Option<Outcome>]` to implement `Index<u32>`
    = note: 1 redundant requirement hidden
    = note: required for `[Option<Outcome>; 64]` to implement `Index<u32>`

Activity

  1. added
    bug
    on Jul 7, 2026
  2. fengints commented on Jul 7, 2026

    @fengints
    Author

    Okay guys this macros seems to work from source but not from
    cargo add glam spirv_std

  3. Firestar99 commented on Jul 8, 2026

    @Firestar99
    Member

    The first error seems like is from you compiling it as a binary for the CPU, instead of as a shader.

    But the second error is actually there, I've found it when we made the page but we never corrected it... 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions