rust-lang / rust-lang/rust-analyzer

Useless diagnostics from procmacro expansion

Open
#16,514 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

rust-analyzer version: rust-analyzer version: 0.4.1834-standalone (c48f14553 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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the diagnostics in Zed at crates/editor/src/display_map.rs:1685 or crates/multi_buffer/src/multi_buffer.rs:4764 using the reported rust-analyzer and rustc versions. Inspect how the #[gpui::test] proc-macro expansion produces the unused-mut warning and compare it with rustc/cargo diagnostics. Done means the expansion no longer exposes this useless diagnostic to the end user.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.