Rust-GPU / Rust-GPU/rust-gpu

spirv attribute errors in proc macros don't show errors properly due to span being the macro invocation

Open
#355 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Rust
Stars
3.4k
Forks
125
PR merge metrics
No merged PRs in 30d

Description

If you codegen spirv entry points and you typo an attribute, you get this error not showing you which one you typo'ed, since the span is from the macro invocation.

  error: unknown argument to spirv attribute
    --> node-graph/graster-nodes/src/adjustments.rs:44:1
     |
  44 | #[node_macro::node(category("Raster: Adjustment"), shader_node(PerPixelAdjust))]
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this error originates in the attribute macro `node_macro::node` (in Nightly builds, run with -Z macro-backtrace for more info)

System Info

  • Rust-GPU master

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the typo in the spirv attribute on node-graph/graster-nodes/src/adjustments.rs:44 and inspect the node_macro::node attribute macro's error reporting. Trace how the attribute span is selected, then verify that an unknown argument identifies the offending attribute rather than only the macro invocation.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.