Skip to content
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

Useless diagnostics from procmacro expansion #16514

Open
SomeoneToIgnore opened this issue Feb 8, 2024 · 2 comments
Open

Useless diagnostics from procmacro expansion #16514

SomeoneToIgnore opened this issue Feb 8, 2024 · 2 comments
Labels
C-bug Category: bug

Comments

@SomeoneToIgnore
Copy link
Contributor

rust-analyzer version: rust-analyzer version: 0.4.1834-standalone (c48f145 2024-02-07)
rustc version: rustc 1.75.0 (82e1608df 2023-12-21)

Open Zed, wait for r-a to load it and produce diagnostics in this file:

https://github.com/zed-industries/zed/blob/bde509fa749da60beb4ac378afd3ade15297bb91/crates/editor/src/display_map.rs#L1685
or
https://github.com/zed-industries/zed/blob/bde509fa749da60beb4ac378afd3ade15297bb91/crates/multi_buffer/src/multi_buffer.rs#L4764

image

this diagnostic is very volatile, but usually appears around those files, sometimes producing dozens of errors, sometimes a couple.
Inside #[gpui::test] macro expansion there's indeed a let mut ... binding that does not need to be mutable, but

  • rustc/cargo does not emit such warnings
  • what the end procmacro user is supposed to do about it?
@SomeoneToIgnore
Copy link
Contributor Author

Found a very minimalistic example:

thread_local! {
    static TEST: bool = false;
}

produces the remove unnecessary else block diagnostics that is totally useless

image

@pacak
Copy link

pacak commented Mar 14, 2024

FWIW the problem is not limited to proc macros. I'm getting an unhelpful diagnostic from anyhow::bail!. It's not like I can do anything about it.

H anyhow::bail!("no rmeta?"); ■ replace return <expr>; with <expr>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants