-
Notifications
You must be signed in to change notification settings - Fork 1.7k
False possitive "this operation is unsafe" with web_sys #15642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
After some more testing, it appears the issue only happens when the full wasm-bindgen git repo exists. If you extract the console_log crate to it's own folder outside of the wasm-bindgen workspace then the false positive doesn't appear. Additionally, the false positive happens both when the wasm-bindgen folder and the console_log folder (while in the wasm-bindgen folder) are opened as the root folder in vscode. As such it appears the false positive is somehow related to cargo workspaces. |
I have also not found any version of rust-analyzer (while using rustc 1.72.1) where this false positive doesn't appear. |
This is caused by cyclic dependencies causing us to be unable to resolve the macros in web-sys properly.
|
The false positive was found for https://github.com/rustwasm/wasm-bindgen/blob/main/examples/console_log/src/lib.rs#L62.
Image showing the false positive error as reported in neovim.

To reproduce clone wasm-bindgen (
or just download the console_log foldersee following comment) and open the console_log crate in an editor. The false positive has been observed in both neovim and vscode for both the latest stable and nightly (0.3.1665 and 0.4.1667).This is likely related to #14766, but I am not sure.
rust-analyzer version: 0.3.1665 and 0.4.1667
rustc version: rustc 1.72.1 (d5c2e9c34 2023-09-13)
relevant settings: Everything was default.
The text was updated successfully, but these errors were encountered: