8214: Mention the rustup version in the manual r=lnicola a=lnicola
Closes#7860
bors r+
changelog fix mention the `rustup` version in the installation instructions.
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
8201: Fix recursive macro statements expansion r=edwin0cheng a=edwin0cheng
This PR attempts to properly handle macro statement expansion by implementing the following:
1. Merge macro expanded statements to parent scope statements.
2. Add a new hir `Expr::MacroStmts` for handle tail expression infer.
PS : The scope of macro expanded statements are so strange that it took more time than I thought to understand and implement it :(
Fixes #8171
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
8191: syntax: return owned string instead of leaking string r=cynecx a=cynecx
Quick hack? to alleviate https://github.com/rust-analyzer/rust-analyzer/issues/8181#issuecomment-806019126. I haven't run any tests but this should affect performance since we are deallocating more.
r? @matklad
Co-authored-by: cynecx <me@cynecx.net>
7907: Autoderef with visibility r=cynecx a=cynecx
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/7841.
I am not sure about the general approach here. Right now this simply tries to check whether the autoderef candidate is reachable from the current module. ~~However this doesn't exactly work with traits (see the `tests::macros::infer_derive_clone_in_core` test, which fails right now).~~ see comment below
Refs:
- `rustc_typeck` checking fields: 66ec64ccf3/compiler/rustc_typeck/src/check/expr.rs (L1610)
r? @flodiebold
Co-authored-by: cynecx <me@cynecx.net>
8190: Fix chalk_ir assertion r=flodiebold a=flodiebold
Fixes#8150.
I implemented a validator that catches this in the tests, but it'd need to get merged in Chalk first.
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
8184: refine comment style of tests r=Veykril a=hi-rustin
Fix the comment style issues, it's in tests but maybe it's a little better to change it to this.
Co-authored-by: hi-rustin <rustin.liu@gmail.com>
8183: Fix missing command error with macros r=Veykril a=brandondong
**Reproduction:**
1. Define a struct through a macro (can be via `macro_rules`, proc macro, or `include!()`).
2. !!MISSING: command!! annotation appears. Clicking on it results in an error message. No matter where the macro is called/defined, the annotation is always at the start of the file.
![image](https://user-images.githubusercontent.com/13722457/112268785-bce14500-8c34-11eb-9a23-bafd63ffd6ef.png)
**Cause:**
- For struct `A`, a `HasImpls` annotation is added just like for struct `B`. Unlike `B`, the file id for `A` is not the file we are adding annotations to but a macro file.
- The resolving step of the code lens does not succeed.
**Fix:**
- Check that the files match before computing offsets and adding `HasImpls`/`HasReferences` annotations.
Co-authored-by: Brandon <brandondong604@hotmail.com>
8182: Trim down IPC json size r=edwin0cheng a=edwin0cheng
This PR try to trim down the json of proc macro IPC by ignore token id if it equals to `TokenId::unspecifed`.
Test by following commands:
```bash
$ git clone https://github.com/gluon-lang/lsp-types.git
$ export RA_LOG="proc_macro_api=debug"
$ rust-analyzer -q analysis-stats --load-output-dirs --with-proc-macro . 2> debug.log
$ cat debug.log | awk '/^\[DEBUG proc_macro_api::msg\] >/ {print substr($0,31)}' >expand.log
$ stat -c "%s" expand.log
```
Before: 37576726
After: 28551718
So it trimed down 75%.
bors r+
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>