As explained in the comments, PostAnalysis is good for most IDE things but not method resolution.
This fixes a bug which should not be impacted by this at all - return position impl trait in trait. It is currently lowered to an opaque, while it should be lowered to an anonymous associated type. But today when it is lowered as an opaque, this opaque of course has no definition and will normalize to an error, preventing method resolution on it from succeeding in some cases.
Example
---
```rust
fn main() {
match 2 {
bar => &bar.l$0
}
}
```
**Before this PR**
```text
sn deref *expr
sn match match expr {}
```
**After this PR**
```text
sn deref *expr
sn let let
sn letm let mut
sn match match expr {}
```
Example
---
```rust
fn main() {
&baz.l$0
}
```
**Before this PR**
```text
sn if if expr {}
sn match match expr {}
```
**After this PR**
```text
sn if if expr {}
sn let let
sn letm let mut
sn match match expr {}
```
Example
---
```rust
fn foo(cond: bool) {
if cond.$0
}
```
**Before this PR**
```text
...
sn deref *expr
sn ref &expr
...
```
**After this PR**
```text
...
sn deref *expr
sn not !expr
sn ref &expr
...
```
Easy to input other patterns, or bind variable in let-chain
Example
---
```rust
fn main() {
let bar = 2;
if bar.$0
}
```
**Before this PR**
No complete 'let'
**After this PR**
```rust
fn main() {
let bar = 2;
if let $1 = bar
}
```
- Added `RecordSpread` enum to distinguish between no spread, field defaults, and spread expressions
- Updated `FieldData` to include `default_value` field
- Modified record literal lowering to handle default field values
- Updated diagnostics to check for missing fields considering defaults
- Added methods to get matched fields for records for completions
- Enhanced hover support for struct rest patterns
rust-analyzer has handy prebuilt `cargo doc` output at
https://rust-lang.github.io/rust-analyzer/ide/
However, it doesn't include private definitions, which makes it less
useful when trying to learn unfamiliar parts of the codebase.
Instead, pass `--document-private-items` so the HTML includes
information on private types and modules too. rustdoc renders these
with a padlock icon, so it's still clear that they're private.
This change also exposes some more rustdoc warnings, which I've fixed.
Example
---
```rust
macro_rules! foo {
($($x:$0)*) => ();
}
```
**Completion items**:
```text
ba block
ba expr
ba expr_2021
ba ident
ba item
ba lifetime
ba literal
ba meta
ba pat
ba pat_param
ba path
ba stmt
ba tt
ba ty
ba vis
```
Example
---
```rust
fn main() {
let bar = Some(true);
bar.i$0
}
```
**Before this PR**
```rust
fn main() {
let bar = Some(true);
if let Some($1) = bar {
$0
}
}
```
**After this PR**
```rust
fn main() {
let bar = Some(true);
if let Some(${1:bar}) = bar {
$0
}
}
```
Example
---
```rust
struct S;
fn foo(s: &&S) {}
fn main() {
let mut ssss = &S;
foo($0);
}
```
**Before this PR**
```rust
st S S []
lc ssss &S [local]
st S S []
fn foo(…) fn(&&S) []
fn main() fn() []
```
**After this PR**
```rust
st S S []
lc ssss &S [local]
lc &ssss [type+local]
st S S []
fn foo(…) fn(&&S) []
fn main() fn() []
```