-
Notifications
You must be signed in to change notification settings - Fork 2k
Open
Labels
A-tytype system / type inference / traits / method resolutiontype system / type inference / traits / method resolutionC-bugCategory: bugCategory: bug
Description
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-tytype system / type inference / traits / method resolutiontype system / type inference / traits / method resolutionC-bugCategory: bugCategory: bug
Type
Fields
Give feedbackNo fields configured for issues without a type.