-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
C-bugCategory: bugCategory: bug
Description
In this code:
pub struct Foo;
impl Foo {
fn needs_mut(&mut self) {}
}
pub fn foo(mut foo: Foo) {
let mut call_me = || {
let 0 = 1 else { return };
foo.needs_mut();
};
call_me();
}
Rust analyzer shows 2 "variable deos not need to be mutable" warnings:
The same code compiles with rustc without any warnings or errors. Removing either mut
makes rust analyzer stop reporting that warning and does not introduce any other diagnostics from ra, but then rustc reports that mut is needed there.
rust-analyzer version: 0.3.1657-standalone (326f37e 2023-09-10)
rustc version: rustc 1.71.0 (8ede3aae2 2023-07-12)
relevant settings:
"rust-analyzer.checkOnSave": false,
"rust-analyzer.completion.postfix.enable": false,
"rust-analyzer.inlayHints.chainingHints.enable": false,
"rust-analyzer.inlayHints.closingBraceHints.enable": false,
"rust-analyzer.inlayHints.parameterHints.enable": false,
"rust-analyzer.inlayHints.typeHints.enable": false,
"rust-analyzer.lens.enable": false,
"rust-analyzer.procMacro.enable": true,
"rust-analyzer.diagnostics.experimental.enable": true,
Metadata
Metadata
Assignees
Labels
C-bugCategory: bugCategory: bug