-
Notifications
You must be signed in to change notification settings - Fork 1.7k
False positive unnecessary 'unsafe' block
warning?
#9576
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
|
It is a decl macro: https://docs.rs/detour/0.8.0/src/detour/macros.rs.html#36-165 |
Oof. There are a lot of unsafe and safe versions of the method there, so RA might be getting the method selection wrong. |
unnecessary
unsafe block
` warning?unnecessary \
unsafe\ block
` warning?
unnecessary \
unsafe\ block
` warning?unnecessary 'unsafe' block
warning?
Oops, I didn't see the missing-unsafe error is from ra, but the warning is from rustc... So it should be safe but it is seen as unsafe by rust-analyzer |
Encountered this when using #[wasm_bindgen(module = "/index.js")]
extern "C" {
#[wasm_bindgen]
pub fn my_function() -> JsValue
}
|
@rossmacarthur try enabling |
It appears that using the nightly channel via |
I'm still getting this error, even with the nightly rust-analyzer (with stable rust and 2021 profile) |
@yatesco if you still have the problem with vim, idk if you use lspconfig, but this is working for me with rust-tools (a wrapper around lspconfig) My Config require('rust-tools').setup {
tools = {
autoSetHints = true,
hover_with_actions = true,
runnables = {use_telescope = true},
inlay_hints = {
show_parameter_hints = false,
parameter_hints_prefix = "",
other_hints_prefix = ""
}
},
-- see https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#rust_analyzer
server = {
settings = {
-- https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/generated_config.adoc
["rust-analyzer"] = {
checkOnSave = {command = "clippy"},
experimental = {procAttrMacros = true},
updates = {channel = "nightly"}
}
}
}
} |
Thanks @ModProg - it's working on the latest nightly now. |
triage: this still happens |
For anybody else still running into this, disabling the "rust-analyzer.diagnostics.disabled": [
"missing-unsafe"
], I was having issues with |
This doesn't happen for me anymore |
I'm not sure if this is a part of
GenericDetour::call
being generated by a macro, I thought this was fixed with expanding macros though. Removing the unsafe block just causes amissing-unsafe
errorThe text was updated successfully, but these errors were encountered: