-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
A-diagnosticsdiagnostics / error reportingdiagnostics / error reportingA-mirC-bugCategory: bugCategory: bug
Description
Rust analyzer version 0.3.2593-standalone (6b2e677795 2025-08-25)
rustc version 1.89.0 (29483883e 2025-08-04)
editor extension: both vscode and zed show the same errors
For a few months I'm getting a few lines of code that are flagged as an error by rust-analyzer but the code compiles just fine with rustc. I tried to simplify the code to a minimal snippet that still triggers the error. The error reported by rust-analyzer is: cannot mutate immutable variable 'b' [E0384]
code snippet to reproduce:
pub trait A: std::ops::IndexMut<usize> {
type T: A;
}
fn func(a: &mut impl A, b: &mut [i32]) {
b[0] += 1;
}
Removing the unused argument a
causes the error to go away.
Metadata
Metadata
Assignees
Labels
A-diagnosticsdiagnostics / error reportingdiagnostics / error reportingA-mirC-bugCategory: bugCategory: bug