rust-analyzer version: 0.4.2809-standalone (a96b6a9 2026-02-28)
rustc version: rustc 1.96.0-nightly (80381278a 2026-03-01)
editor or extension: VS Code extension 0.4.2809
code snippet to reproduce:
struct Cg<const N: usize> {}
type CgMax = Cg<{ usize::MAX }>;
struct Tg<T>(T);
impl From<&'static Tg<CgMax>> for Tg<CgMax> {
fn from(_: &Tg<CgMax>) -> Self {
unimplemented!()
}
}
fn produce() -> &'static [Tg<CgMax>] {
&[]
}
#[allow(dead_code)]
fn consume() {
_ = Tg::from(&produce()[0]);
}
Incorrect diagnostic from rust-analyzer in consume():
expected {unknown}, found &<&'static [Tg<Cg<_>>] as Index<i32>>::Output
(The type alias is not strictly necessary to the reproduction, but the braces are. The i32 mentioned is a red herring; the same incorrect diagnostic appears if the literal index is 0usize.)
@rustbot label +A-ty
rust-analyzer version: 0.4.2809-standalone (a96b6a9 2026-02-28)
rustc version: rustc 1.96.0-nightly (80381278a 2026-03-01)
editor or extension: VS Code extension 0.4.2809
code snippet to reproduce:
Incorrect diagnostic from rust-analyzer in
consume():expected {unknown}, found &<&'static [Tg<Cg<_>>] as Index<i32>>::Output(The type alias is not strictly necessary to the reproduction, but the braces are. The
i32mentioned is a red herring; the same incorrect diagnostic appears if the literal index is0usize.)@rustbot label +A-ty