You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trigger warnings for unused wasm-bindgen attributes
This attempts to do something similar to #3070, but without potentially dangerous fallout from strict-mode failing on all the existing code out there.
Instead of forcing a compiler error like strict-mode does, this PR will internally generate unused variables with spans pointing to unused attributes, so that users get a relatively meaningful warning.
Here's how the result looks like on example from #2874:
```
warning: unused variable: `typescript_type`
--> tests\headless\snippets.rs:67:28
|
67 | #[wasm_bindgen(getter, typescript_type = "Thing[]")]
| ^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_typescript_type`
|
= note: `#[warn(unused_variables)]` on by default
```
This is not 100% perfect - until Rust has a built-in `compile_warning!`, nothing is - but is a better status quo than the current one and can help users find problematic attributes without actually breaking their builds.
Fixes#3038.
0 commit comments