Commit Graph

9807 Commits

Author SHA1 Message Date
Yoshua Wuyts
dfd751303e Move find_struct_impl to assist utils 2021-02-05 14:36:07 +01:00
Yoshua Wuyts
13d663dd16 add generate-enum-match assist 2021-02-05 11:28:11 +01:00
Jonas Schievink
474df093a9 Avoid using ModPath's fields directly 2021-02-04 22:42:21 +01:00
Jonas Schievink
5d99ba1d9a Make ModPath's representation private 2021-02-04 20:49:24 +01:00
Jonas Schievink
003ee0086a Intern TypeRefs in the containing ItemTree 2021-02-04 19:23:56 +01:00
Jonas Schievink
cacaebcb33 Expander: store a LocalModuleId, not ModuleId
It already stores the DefMap containing the module, so having
a full ModuleId is unnecessary and makes it easier to mix things up
2021-02-04 15:04:21 +01:00
Jonas Schievink
26a2a2433c Don't keep the parent DefMap alive via Arc
This seems like it could easily leak a lot of memory since we don't
currently run GC
2021-02-04 13:44:54 +01:00
Jonas Schievink
1a8ea81a79 Split out ItemScope::dump from DefMap::dump 2021-02-03 19:05:11 +01:00
bors[bot]
3ff2aa6d09
Merge #7546
7546: Add newline between block and crate maps r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-02-03 17:25:06 +00:00
Jonas Schievink
6458f9107c Add newline between block and crate maps 2021-02-03 18:23:59 +01:00
Jonas Schievink
eda1cb7ceb Add a FIXME to ItemTree 2021-02-03 18:14:39 +01:00
Jonas Schievink
d4a22fc801 Update DefMap and block_def_map docs 2021-02-03 17:54:03 +01:00
bors[bot]
fd84df9e1b
Merge #7541
7541: Use block_def_map in body lowering (third time's the charm) r=jonas-schievink a=jonas-schievink

After https://github.com/rust-analyzer/rust-analyzer/pull/7380 and https://github.com/rust-analyzer/rust-analyzer/pull/7506 both had to be reverted, this should have finally resolved all remaining bugs.

Most importantly, the optimization to skip `block_def_map` computation when the block contains no inner items was fixed (which fortunately was simpler than expected).

I've ran `analysis-stats` on libstd locally, which works fine, and also ran this PR locally for a short while without issues.

Note that this *still* has no (or almost no) user-facing impact, because the rest of r-a still relies on some local item support hacks.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-02-03 14:41:13 +00:00
Jonas Schievink
63744fe128 Test for name resolution with DefMap shortcut 2021-02-03 15:33:25 +01:00
Jonas Schievink
da57f5dc17 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-03 15:33:25 +01:00
Edwin Cheng
e73ffbf1e5 Add cargo file tidy test 2021-02-03 22:01:09 +08:00
Jonas Schievink
7eff6705cc Use body lowering for block_def_map tests
Removes the hacky and buggy custom lowering code
2021-02-03 14:21:15 +01:00
Jonas Schievink
b7be2b1d3c Use block_def_map in body lowering 2021-02-03 14:21:15 +01:00
Pavan Kumar Sunkara
a89fc070c6
Make sure normal dependencies always have version 2021-02-03 12:51:07 +00:00
Jonas Schievink
5914f86d47 Fix resolution of crate paths from within blocks
They resolve to the crate root, not the DefMap's root module (which
can be a block)
2021-02-02 18:02:12 +01:00
Laurențiu Nicola
6b60206669 Bump rustc_lexer 2021-02-02 17:40:01 +02:00
Laurențiu Nicola
9c4b799dce Bump chalk 2021-02-02 17:40:01 +02:00
kjeremy
953883ca54 Use non-deprecated memmap2 crate
`cargo audit` complains that `memmap` is unmaintained so switch to
RazrFalcon's maintained version.

Removes yet another edge on winapi
2021-02-02 10:25:17 -05:00
lumenian
cafaab8b96 Show alias underlying type 2021-02-02 17:47:56 +03:00
Jonas Schievink
cd9659ffce Use the right DefMap when looking up modules 2021-02-02 12:36:38 +01:00
Jonas Schievink
7202ce6c96
Revert "Use block_def_map in body lowering" 2021-02-02 11:46:58 +01:00
Edwin Cheng
4adf13e2ef Only allow one proc-macro process 2021-02-02 04:55:17 +08:00
Laurențiu Nicola
7ed80bae92 Reap proc macro server instances 2021-02-01 21:24:09 +02: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
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
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
Laurențiu Nicola
89b86839c7 Add --print-config-schema to help 2021-01-29 20:31:12 +02: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
Lukas Wirth
e3eeccf8ef Prefer ValueNS when resolving hir path for PathExpressions 2021-01-29 15:59:52 +01:00
Edwin Cheng
4c7d8cbfbf Rename mbe_expander for consistency 2021-01-29 20:23:38 +08:00
Kirill Bulatov
d7f182bd30 Forbid flyimport completions in use statements 2021-01-29 00:28:54 +02: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