Commit Graph

14830 Commits

Author SHA1 Message Date
bors[bot]
c0d3e315e3
Merge #7509
7509: Improve nvim-lsp setup instructions r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-02-01 18:20:53 +00:00
Laurențiu Nicola
84c324b3dd Improve nvim-lsp setup instructions 2021-02-01 20:20:15 +02:00
bors[bot]
4131e88bb7
Merge #7508
7508: Don't filter code suggestions on Applicability r=lnicola a=CryZe

I've noticed that there are various suggestions that rust-analyzer seems to filter out, even if they make sense.

Here's an example of where it seems like there should be a suggestion, but there isn't:

![https://i.imgur.com/wsjM6iz.png](https://i.imgur.com/wsjM6iz.png)

It turns out that this specific suggestion is not considered `MachineApplicable`, which are the only suggestions that rust-analyzer accepts. However if you read the documentation for `MachineApplicable`,

[Source](b3897e3d13/compiler/rustc_lint_defs/src/lib.rs (L27-L29))
```rust
/// The suggestion is definitely what the user intended. This suggestion should be
/// automatically applied.
MachineApplicable,
```

then you realize that these are specifically only those suggestions that rust-analyzer could even automatically apply (in some distant future, behind some setting or command or so). Other suggestions that may have some semantic impact do not use `MachineApplicable`. So all other suggestions are still intended to be suggested to the user, just not automatically applied without the user being consulted.

[Source](b3897e3d13/compiler/rustc_lint_defs/src/lib.rs (L22-L24))
```rust
/// All suggestions are marked with an `Applicability`. Tools use the applicability of a suggestion
/// to determine whether it should be automatically applied or if the user should be consulted
/// before applying the suggestion.
```

So with that in mind, rust-analyzer should almost definitely not filter out `MaybeIncorrect` (which honestly is named horribly, it just means that it's a semantic change, not just a syntactical one).

Then there's `HasPlaceholders` which basically is just another semantic one, but with placeholders. The user will have to make some adjustments, but the suggestion still is perfectly valid. rust-analyzer could probably detect those placeholders and put proper "tab through" markers there for the IDE, but that's not necessary for now.

Then the last one is `Unspecified` which is so unknown that I don't even know how to judge it, meaning that the suggestion should probably also just be suggested to the user and then they can decide.

So with all that in mind, I'm proposing to get rid of the check for Applicability entirely.

Co-authored-by: Christopher Serr <christopher.serr@gmail.com>
2021-02-01 16:41:52 +00:00
Christopher Serr
b072bbed2a Update Test Data 2021-02-01 17:36:51 +01:00
Christopher Serr
2e8c1d13ad Don't filter code suggestions on Applicability
I've noticed that there are various suggestions that rust-analyzer seems
to filter out, even if they make sense.

Here's an example of where it seems like there should be a suggestion,
but there isn't:

![https://i.imgur.com/wsjM6iz.png](https://i.imgur.com/wsjM6iz.png)

It turns out that this specific suggestion is not considered
`MachineApplicable`, which are the only suggestions that rust-analyzer
accepts. However if you read the documentation for `MachineApplicable`,

b3897e3d13/compiler/rustc_lint_defs/src/lib.rs (L27-L29)

then you realize that these are specifically only those suggestions that
rust-analyzer could even automatically apply (in some distant future,
behind some setting or so). Other suggestions that may have some
semantic impact do not use `MachineApplicable`. So all other suggestions
are still intended to be suggested to the user, just not automatically
applied without the user being consulted.

b3897e3d13/compiler/rustc_lint_defs/src/lib.rs (L22-L24)

So with that in mind, rust-analyzer should almost definitely not filter
out `MaybeIncorrect` (which honestly is named horribly, it just means
that it's a semantic change, not just a syntactical one).

Then there's `HasPlaceholders` which basically is just another semantic
one, but with placeholders. The user will have to make some adjustments,
but the suggestion still is perfectly valid. rust-analyzer could
probably detect those placeholders and put proper "tab through" markers
there for the IDE, but that's not necessary for now.

Then the last one is `Unspecified` which is so unknown that I don't even
know how to judge it, meaning that the suggestion should probably also
just be suggested to the user and then they can decide.

So with all that in mind, I'm proposing to get rid of the check for
Applicability entirely.
2021-02-01 16:57:04 +01:00
bors[bot]
2d9bb69990
Merge #7507
7507: Explain what to do if a release fails r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-02-01 14:46:56 +00:00
Laurențiu Nicola
5e61d62fdc Explain what to do if a release fails 2021-02-01 16:46:23 +02:00
bors[bot]
746b89d1c3
Merge #7506
7506: Use block_def_map in body lowering r=jonas-schievink a=jonas-schievink

This makes `lower_block` update the `DefMap` and `ModuleId` used by the expander to the corresponding `block_def_map`. This cleans up a bit of code, but doesn't expose any new features.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-02-01 12:42:31 +00:00
Jonas Schievink
b4aa860cac Shortcut block_def_map if there's no inner items
This previously didn't work, but apparently only because of the wonky
test setup
2021-02-01 13:33:18 +01:00
Jonas Schievink
80ae583dc0 Use body lowering for block_def_map tests
Removes the hacky and buggy custom lowering code
2021-02-01 13:33:18 +01:00
Jonas Schievink
9cc7d57429 Use block_def_map in body lowering 2021-02-01 13:33:18 +01:00
bors[bot]
1a59f75cda
Merge #7503
7503: Return inner attributes of outline mod declarations in `attrs_query` r=jonas-schievink a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-31 20:13:28 +00:00
bors[bot]
e6e93b3d1d
Merge #7502
7502: Honor #![macro_use] in mod source files r=jonas-schievink a=Veykril

Fixes #7501

Since `ItemTree` builds the `RawAttrs` directly we need the special check here as I don't think we can fix this in `RawAttrs` constructor as its solely AST based and we need to touch two different ASTs here.

This just made me realize that `attrs_query` suffers from a similar problem, for example hovering an outline `mod` decl won't show inner docs, only outer ones, #7503.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-31 20:04:07 +00:00
Lukas Wirth
999e020da2 Return inner attributes of outline mod declarations in attrs_query 2021-01-31 19:53:01 +01:00
Lukas Wirth
412f180d71 Honor #![macro_use] in mod source files 2021-01-31 19:33:02 +01:00
bors[bot]
286d90de2d
Merge #7500
7500: Fix ast::String::value not properly escaping in some cases r=Veykril a=Veykril

Fixes #7496
bors r+


Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-30 17:12:56 +00:00
Lukas Wirth
6c2ce55150 Fix ast::String::value not properly escaping in some cases 2021-01-30 16:31:19 +01:00
bors[bot]
f408ff5013
Merge #7483
7483: Classify function calls as functions when shadowed by types r=matklad a=Veykril

Fixes #7479

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-30 15:23:21 +00:00
bors[bot]
557c1e36dd
Merge #7494
7494: Simpilfy mbe parsing r=edwin0cheng a=edwin0cheng

bors r+

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-01-30 08:13:32 +00:00
Edwin Cheng
438b34dcee Simpilfy mbe parsing 2021-01-30 16:12:30 +08:00
bors[bot]
715dade21b
Merge #7493
7493: Add --print-config-schema to help r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-01-29 18:32:10 +00:00
Laurențiu Nicola
89b86839c7 Add --print-config-schema to help 2021-01-29 20:31:12 +02:00
bors[bot]
e7108fb5b1
Merge #7491
7491: Simplify mbe match error. r=edwin0cheng a=edwin0cheng

Handle parse error in rule parsing instead of matching in mbe.

bors r+

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-01-29 16:24:16 +00:00
Edwin Cheng
706ac8256d Simplify mbe match error.
Handle parse error in rule parsing instead of match in mbe
2021-01-30 00:21:43 +08:00
bors[bot]
d2a73c6164
Merge #7490
7490: cargo update r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-01-29 15:13:48 +00:00
kjeremy
16f40d6e20 cargo update 2021-01-29 10:12:39 -05:00
Lukas Wirth
e3eeccf8ef Prefer ValueNS when resolving hir path for PathExpressions 2021-01-29 15:59:52 +01:00
bors[bot]
188db89c13
Merge #7489
7489: ⬆️ rowan r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-29 13:13:05 +00:00
Aleksey Kladov
921bfc0984 ⬆️ rowan 2021-01-29 16:12:41 +03:00
bors[bot]
3ecd5112bb
Merge #7488
7488: Rename mbe_expander for consistency r=edwin0cheng a=edwin0cheng

bors r+

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-01-29 12:24:38 +00:00
Edwin Cheng
4c7d8cbfbf Rename mbe_expander for consistency 2021-01-29 20:23:38 +08:00
bors[bot]
0ac4a8f354
Merge #7487
7487: Forbid flyimport completions in use statements r=SomeoneToIgnore a=SomeoneToIgnore

Closes #7469

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2021-01-28 22:31:34 +00:00
Kirill Bulatov
d7f182bd30 Forbid flyimport completions in use statements 2021-01-29 00:28:54 +02:00
bors[bot]
a3e4f07a83
Merge #7486
7486: ⬆️ rowan r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-28 19:27:59 +00:00
Aleksey Kladov
06b56e720f ⬆️ rowan 2021-01-28 22:27:35 +03:00
bors[bot]
f51ba7d8a4
Merge #7485
7485: Fix incorrect `FileId` and remove broken shortcut r=jonas-schievink a=jonas-schievink

Apparently we were using the crate's root file instead of the file
containing the block.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-01-28 18:34:57 +00:00
Jonas Schievink
090b2f0e50 Fix incorrect FileId and remove broken shortcut
Apparently we were using the crate's root file instead of the file
containing the block.
2021-01-28 19:33:00 +01:00
Lukas Wirth
426ad8e165 Classify function calls as functions when shadowed by types 2021-01-28 19:08:55 +01:00
bors[bot]
fa1b500d2f
Merge #7482
7482: block_def_map: add a few macro tests r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-01-28 17:55:54 +00:00
Jonas Schievink
7177045a67 block_def_map: add a few macro tests 2021-01-28 18:53:35 +01:00
bors[bot]
703e6bfdb6
Merge #7412
7412: Async loading for outdir and proc-macro r=maklad a=edwin0cheng

cc #7328

![Peek 2021-01-24 02-04](https://user-images.githubusercontent.com/11014119/105610083-8f208100-5de8-11eb-8e96-c2d4e349b352.gif)

[Edit] 
~~Finding a way to know when the workspace and build data are loaded...~~

[Edit 2] 
Not perfect solution, but seem to work now.


Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-01-28 17:43:51 +00:00
Edwin Cheng
d069ef60b6 Update lsp-extension.md hash 2021-01-29 01:32:31 +08:00
bors[bot]
00b9b2d645
Merge #7481
7481: Update `original_module` when ascending `DefMap`s r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-01-28 17:28:58 +00:00
Jonas Schievink
232b75394e Update original_module when ascending DefMaps 2021-01-28 18:27:27 +01:00
Edwin Cheng
dd47f8bac6 bug fix 2021-01-29 01:19:09 +08:00
Edwin Cheng
edcafe7865 Update doc 2021-01-29 01:04:14 +08:00
Edwin Cheng
35310f1032 Update vscode for new status 2021-01-29 01:04:14 +08:00
Edwin Cheng
9358eecc04 Async Loading outdir and proc-macro 2021-01-29 01:04:14 +08:00
bors[bot]
868887ec4e
Merge #7480
7480: ItemTree: Treat items in `MacroStmts` as top-level r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-01-28 17:02:24 +00:00
Jonas Schievink
2aebde6c0b ItemTree: Treat items in MacroStmts as top-level 2021-01-28 18:00:10 +01:00