Commit graph

15035 commits

Author SHA1 Message Date
Vladyslav Katasonov
86ff1d4809 allow &mut param when extracting function
Recognise &mut as variable modification.
This allows extracting functions with
`&mut var` with `var` being in outer scope
2021-02-04 00:27:31 +03:00
Vladyslav Katasonov
f102616aae allow modifications of vars from outer scope inside extracted function
It currently allows only directly setting variable.
No `&mut` references or methods.
2021-02-03 23:45:03 +03:00
Vladyslav Katasonov
82787febde allow local variables to be used after extracted body
when variable is defined inside extracted body
export this variable to original scope via return value(s)
2021-02-03 21:11:12 +03:00
bors[bot]
74a223faa3
Merge #7547
7547: Split out ItemScope::dump from DefMap::dump r=jonas-schievink a=jonas-schievink

This is helpful for more targeted debugging

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-02-03 18:06:55 +00: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
bors[bot]
a6ccd50ece
Merge #7545
7545: Add a FIXME to ItemTree r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-02-03 17:15:21 +00:00
Jonas Schievink
eda1cb7ceb Add a FIXME to ItemTree 2021-02-03 18:14:39 +01:00
bors[bot]
6817f1ff99
Merge #7544
7544: Update `DefMap` and `block_def_map` docs r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-02-03 16:54:29 +00:00
Jonas Schievink
d4a22fc801 Update DefMap and block_def_map docs 2021-02-03 17:54:03 +01:00
bors[bot]
c92be90fd2
Merge #7543
7543: Grammar fixes r=Kushagra-0801 a=Kushagra-0801

I think line 235 is still wrong, but I am not sure.

Is the `crated/tt` in line 252 supposed to be `crates/tt`?

Co-authored-by: Kushagra Gupta <39802979+Kushagra-0801@users.noreply.github.com>
2021-02-03 16:20:25 +00:00
Kushagra Gupta
b75e85998d
typo fixes 2021-02-03 21:30:42 +05:30
Kushagra Gupta
ed35e516b1
Grammar fixes
I think line 235 is still wrong, but I am not sure.

Is the `crated/tt` in line 252 supposed to be `crates/tt`?
2021-02-03 21:05:21 +05:30
Vladyslav Katasonov
313aa5f3a2 change TODO to FIXME 2021-02-03 17:47:21 +03:00
Vladyslav Katasonov
f0d2bb9131 disable test for downgrading mutability on extract 2021-02-03 17:46:57 +03:00
Vladyslav Katasonov
88b3034636 convert IdentPat to Pat via Into
before child getter was used
2021-02-03 17:45:36 +03: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
bors[bot]
93ecef53a3
Merge #7539
7539: Add cargo file tidy test r=edwin0cheng a=edwin0cheng

bors r+

cc @pksunkara 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-02-03 14:02:30 +00: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
bors[bot]
85e1f0905a
Merge #7538
7538: Make sure normal dependencies always have version r=edwin0cheng a=pksunkara

How do I prevent this happening in the future by doing something in the CI? IIRC this is the second time.

Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
2021-02-03 12:59:22 +00:00
Pavan Kumar Sunkara
a89fc070c6
Make sure normal dependencies always have version 2021-02-03 12:51:07 +00:00
bors[bot]
05b3fe4255
Merge #7537
7537: Fix spelling mistakes in docs/dev r=Veykril a=Veykril

Also adds a line for `crates/cfg` and `crates/stdx` to the architecture.

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-02-03 12:48:13 +00:00
Lukas Wirth
f82ce500a9 Fix spelling mistakes in docs/dev 2021-02-03 13:46:51 +01:00
bors[bot]
81a9ad3672
Merge #7536
7536: Make architecture more informative r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-02-03 11:26:49 +00:00
Aleksey Kladov
1008aaae58 Make architecture more informative
Call out boundaries and invariants
2021-02-03 14:26:23 +03:00
Vladyslav Katasonov
1e6f13a0be support extracting methods; no mut lowering
currently mut refernce will *not* be downgraded to shared
if it is sufficient(see relevant test for example)
2021-02-03 12:27:53 +03:00
Vladyslav Katasonov
bc3ae81a87 initial version of extract function assist
there are a few currently limitations:
* no modifications of function body
* does not handle mutability and references
* no method support
* may produce incorrect results
2021-02-03 10:57:11 +03:00
bors[bot]
95e03ec499
Merge #7528
7528: Update mimalloc r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-02-02 22:18:58 +00:00
kjeremy
b9ad1f587d Update mimalloc 2021-02-02 17:17:49 -05:00
bors[bot]
7e66cde764
Merge #7525
7525: Fix resolution of `crate` paths from within blocks r=jonas-schievink a=jonas-schievink

They resolve to the crate root, not the DefMap's root module (which
can be a block)

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-02-02 17:02:48 +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
bors[bot]
12e8cc4aa2
Merge #7523
7523: Bump chalk and rustc_lexer r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-02-02 15:40:43 +00: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
bors[bot]
042e07d891
Merge #7522
7522: Use non-deprecated memmap2 crate r=kjeremy a=kjeremy

`cargo audit` complains that `memmap` is unmaintained so switch to
RazrFalcon's maintained version.

Removes yet another edge on winapi

Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-02-02 15:27:01 +00: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
bors[bot]
a02a7a9aa6
Merge #7521
7521: cargo update r=kjeremy a=kjeremy

Pulls in soundness fix from rowan.

Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-02-02 15:09:34 +00:00
kjeremy
1c9e216f69 cargo update 2021-02-02 10:00:34 -05:00
bors[bot]
cc3112de1b
Merge #7520
7520: Show alias underlying type r=lnicola a=lumenian

Closes #7511 

Display underlying type in the tooltip:
```rust
pub type SomeAlias = f64
```
instead of:
```rust
pub type SomeAlias
```

Co-authored-by: lumenian <lumenian@gmail.com>
2021-02-02 14:59:29 +00:00
lumenian
cafaab8b96 Show alias underlying type 2021-02-02 17:47:56 +03:00
bors[bot]
96f9f0741f
Merge #7519
7519: add useless types to the styleguide r=matklad a=matklad

bors r+

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-02-02 13:09:21 +00:00
Aleksey Kladov
283c3b0133 add useless types to the styleguide 2021-02-02 15:41:57 +03:00
bors[bot]
8720f7f146
Merge #7518
7518: Use the right `DefMap` when looking up modules r=jonas-schievink a=jonas-schievink

Fixes the bugs encountered in https://github.com/rust-analyzer/rust-analyzer/pull/7506#issuecomment-771417467

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-02-02 11:37:45 +00:00
Jonas Schievink
cd9659ffce Use the right DefMap when looking up modules 2021-02-02 12:36:38 +01:00
bors[bot]
157156276b
Merge #7516
7516: Revert "Use block_def_map in body lowering" r=jonas-schievink a=jonas-schievink

Reverts rust-analyzer/rust-analyzer#7506

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-02-02 10:47:22 +00:00