You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rust-analyzer gets confused about IntoIterator::Item types when multiple generic parameters implement IntoIterator.
Example:
pubfnitem_type_confusion<'a,I:IntoIterator<Item = &'a mutusize>,I2:IntoIterator>(it:I){for a in it {// rust-analyzer reports error: cannot mutate immutable variable `a`*a += 1;}}
This error is only reported in rust-analyzer. The function compiles without errors. Furthermore, neither cargo check nor cargo clippy report any errors.
The hover-text on a is a: {unknown}, which shows that rust-analyzer was unable to infer the type of a.
This occurs even when I and I2 have the same Item type:
relevant settings: CARGO_HOME is set to $HOME/.local/share/cargo RUSTUP_HOME is set to $HOME/.local/share/rustup RUSTC_WRAPPER is set to sccache
rust-analyzer settings are:
rust-analyzer gets confused about
IntoIterator::Item
types when multiple generic parameters implementIntoIterator
.Example:
This error is only reported in rust-analyzer. The function compiles without errors. Furthermore, neither
cargo check
norcargo clippy
report any errors.The hover-text on
a
isa: {unknown}
, which shows that rust-analyzer was unable to infer the type ofa
.This occurs even when
I
andI2
have the sameItem
type:If I coerce
a
into an&mut usize
, the error goes away:rust-analyzer does recognise that
a
is an&mut usize
when printing a type error, but still claims that*a
is immutable:Furthermore, if
I2: IntoIterator
is removed, the error goes away:rust-analyzer version: rust-analyzer 1.72.0-nightly (8084f39 2023-06-25)
rustc version: rustc 1.72.0-nightly (8084f397c 2023-06-25)
relevant settings:
CARGO_HOME
is set to$HOME/.local/share/cargo
RUSTUP_HOME
is set to$HOME/.local/share/rustup
RUSTC_WRAPPER
is set tosccache
rust-analyzer settings are:
(this is copied verbatim from my Neovim configuration)
The text was updated successfully, but these errors were encountered: