Commit graph

12183 commits

Author SHA1 Message Date
Kirill Bulatov
cfbbd91a88 Require source implementations for Diagnostic 2020-08-11 15:09:08 +03:00
Kirill Bulatov
21184a1b2a Restore accidentally removed public method 2020-08-11 15:09:08 +03:00
Kirill Bulatov
cb0b13a583 Fix another missing fields diagnostics 2020-08-11 15:09:08 +03:00
Kirill Bulatov
ee1586c1ed Better naming 2020-08-11 15:09:08 +03:00
Kirill Bulatov
a61f2445cb Less stubs 2020-08-11 15:09:08 +03:00
Kirill Bulatov
21e5224484 Custom ranges for missing fields 2020-08-11 15:09:08 +03:00
Kirill Bulatov
26e102a567 Separate diagnostics and diagnostics fix ranges 2020-08-11 15:09:08 +03:00
bors[bot]
e0de247520
Merge #5708
5708: Use Hygiene in completion r=jonas-schievink a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-08-11 10:30:39 +00:00
bors[bot]
ef20dfc78d
Merge #5707
5707: Address some FIXMEs for ra_assists r=jonas-schievink a=JmPotato

Signed-off-by: JmPotato <ghzpotato@gmail.com>

Co-authored-by: JmPotato <ghzpotato@gmail.com>
2020-08-11 10:22:57 +00:00
bors[bot]
61ee051455
Merge #5705
5705: Log the command flycheck runs to debug misconfigurations r=jonas-schievink a=Veetaha

Without this users have no clue why flycheck fails to run.
This is what is printed to the output channel:
```
[ERROR rust_analyzer::main_loop] cargo check failed: Cargo watcher failed,the command produced no valid metadata (exit code: ExitStatus(ExitStatus(25856)))
```

I stumbled with this figuring out that rust-analyzer adds `--all-features` which is not intended
for some crates in the workspace (i.e. they have mutually-exclusive features).
Having the command rust-analyzer ran should help a lot

Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-08-11 10:15:46 +00:00
bors[bot]
c1a5257b6d
Merge #5704
5704: Update README.md r=jonas-schievink a=tim-weis

Fixed formatting.

Co-authored-by: Tim Weis <tim-weis@users.noreply.github.com>
2020-08-11 10:08:27 +00:00
JmPotato
6ef019bd46 Revert some FIXMEs
Signed-off-by: JmPotato <ghzpotato@gmail.com>
2020-08-11 17:19:02 +08:00
JmPotato
7fbc9afca4 Typo fix
Signed-off-by: JmPotato <ghzpotato@gmail.com>
2020-08-11 16:50:45 +08:00
Laurențiu Nicola
fc01c7846d Use Hygiene in completion 2020-08-11 10:09:50 +03:00
JmPotato
b69dfddb57 Remove redundant dependencies
Signed-off-by: JmPotato <ghzpotato@gmail.com>
2020-08-11 14:35:15 +08:00
JmPotato
ace75f9590 Typo fix
Signed-off-by: JmPotato <ghzpotato@gmail.com>
2020-08-11 12:09:11 +08:00
JmPotato
dc6e1e0dac Address some FIXMEs
Signed-off-by: JmPotato <ghzpotato@gmail.com>
2020-08-11 10:55:26 +08:00
Veetaha
4f386afb16 Log the command flycheck runs to debug misconfigurations
Without this users have no clue why flycheck fails to run.
This is what is printed to the output channel:
```
[ERROR rust_analyzer::main_loop] cargo check failed: Cargo watcher failed,the command produced no valid metadata (exit code: ExitStatus(ExitStatus(25856)))
```

I stumbled with this figuring out that rust-analyzer adds `--all-features` which is not intended
for some crates in the workspace (e.g. they have mutually-exclusive features.
Having the command rust-analyzer ran should help a lot
2020-08-11 03:12:09 +03:00
Tim Weis
a8beb79a16
Update README.md
Fixed formatting.
2020-08-11 01:01:25 +02:00
bors[bot]
b050937c10
Merge #5703
5703: Fix typos in syntax.md r=kjeremy a=lnicola

Closes #5700

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-08-10 19:38:19 +00:00
Laurențiu Nicola
ff60fdc315 Fix typos in syntax.md 2020-08-10 21:31:38 +03:00
bors[bot]
1e310575e3
Merge #5701
5701: cargo update r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-08-10 17:20:14 +00:00
bors[bot]
58711bda3d
Merge #5696
5696: Return InvalidRequest if Shutdown has been requested r=kjeremy a=kjeremy

From the LSP 3.16 spec: "If a server receives requests after a shutdown request those requests should error with InvalidRequest."

Realized this behavior was missing while looking at #5693. Question on notification behavior is tracked at https://github.com/microsoft/language-server-protocol/issues/1066

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-08-10 15:14:02 +00:00
Jeremy Kolb
cf6d14cee7 Return InvalidRequest if Shutdown has been requested
From the LSP 3.16 spec: "If a server receives requests after a shutdown request those requests should error with InvalidRequest."
2020-08-10 11:03:08 -04:00
kjeremy
9842bbfd27 cargo update 2020-08-10 10:56:16 -04:00
bors[bot]
cef39c3efb
Merge #5697
5697: Remove workaround for semantic token flickering r=jonas-schievink a=kjeremy

See: https://github.com/microsoft/vscode-languageserver-node/issues/576#issuecomment-593384479

This has been fixed since vscode 1.44

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-08-10 14:48:19 +00:00
Igor Aleksanov
d180b8bbe8 Revert boxing for large enum variant 2020-08-10 15:50:27 +03:00
Paul Daniel Faria
72baf1acdd Remove unused import left behind after rebasing 2020-08-10 08:46:34 -04:00
Paul Daniel Faria
2199d0cda9 Fix type names broken by rebase, redo expected test because of rebase 2020-08-10 08:46:34 -04:00
Paul Daniel Faria
61dff939f9 Move unsafe semantics methods into SemanticsImpl and reference them in Semantics 2020-08-10 08:46:34 -04:00
Paul Daniel Faria
39fdd41df4 Return bool from is_unsafe_method_call and cleanup usages 2020-08-10 08:46:34 -04:00
Paul Daniel Faria
a6af0272f7 Move semantic logic into Semantics, fix missing tag for safe amp operator, using functional methods rather than clunky inline closure 2020-08-10 08:46:34 -04:00
Paul Daniel Faria
87cb09365c Remove merge backup 2020-08-10 08:44:54 -04:00
Paul Daniel Faria
55633f3404 Fix rebase errors 2020-08-10 08:44:54 -04:00
Paul Daniel Faria
08182aa9fa Move unsafe packed ref logic to Semantics, use Attrs::by_key to simplify repr attr lookup 2020-08-10 08:44:54 -04:00
Paul Daniel Faria
c5cc24cb31 Revert function structs back to using bool to track self param, use first param for self information in syntax highlighting instead 2020-08-10 08:44:54 -04:00
Paul Daniel Faria
aca3d6c57e Deduplicate unsafe method call into a single function 2020-08-10 08:44:54 -04:00
Paul Daniel Faria
d5f11e530d Unsafe borrow of packed fields: account for borrow through ref binding, auto ref function calls 2020-08-10 08:44:54 -04:00
Paul Daniel Faria
38440d53d8 Cleanup repr check, fix packed repr check and test 2020-08-10 08:44:54 -04:00
Paul Daniel Faria
c9e670b875 Update FIXME comment to be more useful 2020-08-10 08:44:54 -04:00
Paul Daniel Faria
4a4b1f48ef Limit scope of unsafe to & instead of all ref exprs, add test showing missing support for autoref behavior 2020-08-10 08:44:54 -04:00
Paul Daniel Faria
fd30134cf8 Remove token tree from ReprKind::Other variant, expose ReprKind higher, remove debug println. 2020-08-10 08:44:54 -04:00
Paul Daniel Faria
263f9a7f23 Add tracking of packed repr, use it to highlight unsafe refs
Taking a reference to a misaligned field on a packed struct is an
unsafe operation. Highlight that behavior. Currently, the misaligned
part isn't tracked, so this highlight is a bit too aggressive.
2020-08-10 08:44:54 -04:00
Igor Aleksanov
6344a7f362 Fix clippy warnings 2020-08-10 15:05:01 +03:00
bors[bot]
f3336509e5
Merge #5698
5698: Display the value of a const on the hover r=jonas-schievink a=JmPotato

Signed-off-by: JmPotato <ghzpotato@gmail.com>

Close #4051 

To display the value of a const, I modified the implementation of `ShortLabel` for `ast::Const`.

Co-authored-by: JmPotato <ghzpotato@gmail.com>
2020-08-10 09:55:58 +00:00
JmPotato
958b91c1e8 Better codes
Signed-off-by: JmPotato <ghzpotato@gmail.com>
2020-08-10 17:51:45 +08:00
JmPotato
4d9c8821e5 Show const body in short_label
Signed-off-by: JmPotato <ghzpotato@gmail.com>
2020-08-10 14:02:40 +08:00
bors[bot]
7a03f05eac
Merge #5692
5692: Add support for extern crate r=jonas-schievink a=Nashenas88

This adds syntax highlighting, hover and goto def functionality for extern crate.

Fixes #5690 

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
2020-08-09 23:16:58 +00:00
Paul Daniel Faria
bf9b4578bb Remove Option<...> from result of Crate::root_module
There doesn't seem to be any need for it, and removing it simplies
several paths of code that depend on it.
2020-08-09 18:52:19 -04:00
bors[bot]
b1cb4ac13d
Merge #5693
5693: Fix no inlay hints / unresolved tokens until manual edit to refresh r=jonas-schievink a=Veetaha

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/5349 

Now we return ContentModified during the workspace loading. This signifies the language
client to retry the operation (i.e. the client will
continue polling the server while it returns ContentModified).
I believe that there might be cases of overly big projects where the backoff
logic we have setup in `sendRequestWithRetry` (which we use for inlay hints)
might bail too early (currently the largest retry standby time is 10 seconds).
However, I've tried on one of my project with 500+ dependencies and it is still enough.

Here are the examples before/after the change (the gifs are quite lengthy because they show testing rather large cargo workspace).

<details>
<summary>Before</summary>

Here you can see that the client receives empty array of inlay hints and does nothing more.
Same applies to semantic tokens. The client receives unresolved tokens and does nothing more.
The user needs to do a manual edit to refresh the editor.

![prev-demo](https://user-images.githubusercontent.com/36276403/89717721-e4471280-d9c1-11ea-89ce-7dc3e83d9768.gif)

</details>

<details>
<summary>After</summary>

Here the server returns ContentModified, so the client periodically retries the requests and eventually receives the wellformed response.

![new-demo](https://user-images.githubusercontent.com/36276403/89717725-eb6e2080-d9c1-11ea-84c9-796bb2b22cec.gif)

</details>

Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-08-09 22:39:10 +00:00