Consider this snippet:
enum Foo {
Bar {
v: u32,
},
Baz(u32),
}
fn main() {
let v = 31;
let u = Foo::Bar { v };
}
If you, in vscode, right click onto Foo in enum Foo { to get the places it's referenced, it won't list you any references. Similarly, if you right click on v in let v = 31;, there won't be any references listed. However, both are referenced one line below. Now, if you add let w = Foo::Baz(v);, then the Baz reference will be recorded for both Foo and v. So the problem is that enum struct variant constructor expressions aren't being considered for references.
Thisis no rls bug as the save-analysis by rustc is wrong. If you dump the save-analysis generated for the code above, you'll notice that the refs array is empty while it should contain entries for uses of Foo and the local v variable (as well as the Bar enum variant but that is a separate bug, it doesn't just affect struct variant constructors. See #61302).
Consider this snippet:
If you, in vscode, right click onto
Fooinenum Foo {to get the places it's referenced, it won't list you any references. Similarly, if you right click onvinlet v = 31;, there won't be any references listed. However, both are referenced one line below. Now, if you addlet w = Foo::Baz(v);, then theBazreference will be recorded for bothFooandv. So the problem is that enum struct variant constructor expressions aren't being considered for references.Thisis no rls bug as the save-analysis by rustc is wrong. If you dump the save-analysis generated for the code above, you'll notice that the refs array is empty while it should contain entries for uses of
Fooand the localvvariable (as well as theBarenum variant but that is a separate bug, it doesn't just affect struct variant constructors. See #61302).