Fix `preorder_expr` skipping the `else` block of let-else statements
Fixes exit/yield points not getting highlighted in such blocks for `highlight_related` (#14813; and possibly other bugs in features that use `preorder_expr`).
Fixes exit/yield points not getting highlighted in such blocks for `highlight_related` (#14813; and possibly other bugs in features that use `preorder_expr`).
Add layout info for enum variant and locals
The size of enum variant is what rustdoc shows (https://github.com/rust-lang/rust/pull/86263). I also added layout info for locals since it helps finding size of unnameable types like closures inside other structs or impl traits.
Add `moved-out-of-ref` diagnostic
This is marked as experimental, since spans are terrible, there are some false positives due #14754, and it doesn't play well with unknown types. But I hope we can soon lift it.
Partially support panic message in `MirEvalError`
And bring the metrics back, by using `::core` instead of `$crate` in `format_args!` (it looks like eager macros don't support them).
MIR episode 5
This PR inits drop support (it is very broken at this stage, some things are dropped multiple time, drop scopes are wrong, ...) and adds stdout support (`println!` doesn't work since its expansion is dummy, but `stdout().write(b"hello world\n")` works if you use `RA_SYSROOT_HACK`) for interpreting. There is no useful unit test that it can interpret yet, but it is a good sign that it didn't hit a major road block yet.
In MIR lowering, it adds support for slice pattern and anonymous const blocks, and some fixes so that we can evaluate `SmolStr::new_inline` in const eval. With these changes, 57 failed mir body remains.
fix: Force disable augmentsSyntaxTokens capability on VSCode
The default textmate grammar for rust in VSCode is pretty brittle, quite often coloring things very differently than we'd like to so we force full semantic highlighting by disabling that config.
fix: Diagnose non-value return and break type mismatches
Could definitely deserve more polished diagnostics, but this at least brings the message across for now.
fix(analysis-stats): divided by zero error
## What does this PR try to resolve?
2023-05-15 rust-analyzer suffers from
```
thread 'main' panicked at 'attempt to divide by zero', crates/rust-analyzer/src/cli/analysis_stats.rs:230:56
```
This commit <51e8b8ff14> might be the culprit.
This PR uses `percentage` function to avoid the classic “division by zero” bug.
## Reproducer
```console
cargo new ra-test
pushd ra-test
echo "pub type Foo = u32;" >> src/lib.rs
rust-analyzer analysis-stats .
```
Support `#[macro_use(name, ...)]`
This PR adds support for another form of the `macro_use` attribute: `#[macro_use(name, ...)]` ([reference]).
Note that this form of the attribute is only applicable to extern crate decls, not to mod decls.
[reference]: https://doc.rust-lang.org/reference/macros-by-example.html#the-macro_use-attribute