Shadowing function arguments compiled sucessfully but generates invalid wgsl
- Dominant language
- Rust
- Stars
- 62
- Forks
- 5
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 14
Description
```rust
#[wgsl]
pub mod my_shader {
pub fn my_func(x: f32) {
let x = 0.0;
}
}
```
compiles successfully, but when you try and run the wgsl:
```
Caused by:
In Device::create_shader_module, label = 'compute'
Shader 'compute' parsing error: redefinition of `x`
┌─ wgsl:68:12
│
68 │ fn my_func(x: f32) {
│ ^ previous definition of `x`
69 │ let x = 0.0;
│ ^ redefinition of `x`
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the provided Rust reproduction using the #[wgsl] entry point and my_func, then inspect the generated WGSL and reproduce the error when creating the shader module. Trace how function arguments and local bindings are emitted; done means the example no longer produces invalid WGSL and the generated shader is accepted.
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
- 68/100