Vladyslav Katasonov
7eaa3e56a0
allow extracted body to be indented(dedent it)
2021-02-05 05:44:08 +03:00
Vladyslav Katasonov
876ca60316
allow transitive &mut
access for fields in extract_function
2021-02-05 04:35:41 +03:00
Vladyslav Katasonov
271c1cb013
add tests for extracting if/match/while/for exprs
2021-02-05 02:30:34 +03:00
Vladyslav Katasonov
4dc2a42500
document extract_function assist implementation
2021-02-05 02:14:32 +03:00
Vladyslav Katasonov
0ff74467c0
use &T
for non copy params of extracted function
...
Use shared ref if param is not `T: Copy` and is used after body
2021-02-05 01:41:40 +03:00
Vladyslav Katasonov
d9b122858b
split extract_function into pieces and order them
2021-02-05 00:35:28 +03:00
Vladyslav Katasonov
ff77c5e68f
remove ignored test for downgrading mut to shared
2021-02-04 00:52:53 +03:00
Vladyslav Katasonov
c4f3669e70
allow calling &mut
methods on outer vars when extracing function
2021-02-04 00:44:36 +03:00
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
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
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
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
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
Jonas Schievink
232b75394e
Update original_module
when ascending DefMap
s
2021-01-28 18:27:27 +01:00
Edwin Cheng
dd47f8bac6
bug fix
2021-01-29 01:19:09 +08:00