Commit Graph

5761 Commits

Author SHA1 Message Date
Edwin Cheng
55061b489f Improve shutdown process 2020-03-31 22:20:18 +08:00
Edwin Cheng
1b8a26653f Use matches in is_dylib 2020-03-31 22:20:18 +08:00
Edwin Cheng
3b97220926 Add back doc string for process 2020-03-31 22:20:18 +08:00
Edwin Cheng
fa621f80fa Fix test 2020-03-31 22:20:18 +08:00
Edwin Cheng
503cbd3f4b Implement ra_proc_macro client logic 2020-03-31 22:20:18 +08:00
Aleksey Kladov
569f47e427 Better names for config structs 2020-03-31 16:05:25 +02:00
bors[bot]
30466e068b
Merge #3778
3778: Use more functional programming in ArenaMap::insert r=matklad a=kjeremy

I find this more readable and it flattens out the body a little. Others may disagree.

Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-03-31 13:04:54 +00:00
kjeremy
7ca5ef67e8 Use resize_with 2020-03-31 09:02:12 -04:00
bors[bot]
2cdeb7363a
Merge #3786
3786: When adding match arm, don't let the floating comma r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-31 12:53:51 +00:00
Aleksey Kladov
2fe6e23138 When adding match arm, don't let the floating comma 2020-03-31 14:52:20 +02:00
bors[bot]
d63bb8565e
Merge #3781
3781: Add crate versions when running cargo -p commands. r=matklad a=o0Ignition0o

If someone (unfortunately) creates a project that happens to have the same name as one of its (future) dependencies, there is [a way for them to change the dependency's alias in the Cargo.toml file](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#renaming-dependencies-in-cargotoml), to mitigate the name conflict. Unfortunately cargo -p commands don't seem to pick it up, which seems to put rust-analyzer run commands in a tough situation: 

```
> Executing task: cargo test --package config --example default -- tests --nocapture <

error: There are multiple `config` packages in your project, and the specification `config` is ambiguous.
Please re-run this command with `-p <spec>` where `<spec>` is one of the following:
  config:0.1.0
  config:0.9.3
The terminal process terminated with exit code: 101
```

cargo suggests us to be more specific and refer to a package by its name and version, which this PR achieves.

I passed the version as a String because I don't really understand how the ra_db types work, but I would love to switch it to [a fully fledged Version type](https://steveklabnik.github.io/semver/semver/index.html) if you guide me towards that :)



Co-authored-by: o0Ignition0o <jeremy.lempereur@gmail.com>
2020-03-31 12:45:39 +00:00
o0Ignition0o
331d1db317 Add crate versions when running cargo -p commands.
Until now cargo commands with the -p flag would pass the package name only.
It doesn't play super well with the toml Renaming dependencies feature.
This commit specifies the package name and version when a cargo command is run with the -p flag,
to avoid ambiguities.
2020-03-31 14:43:39 +02:00
Leander Tentrup
77f89a700b Attach doc-comment to declaration if there are newlines in between
This commit changes the parser to attach doc-comments to the corresponding declaration in case there are newlines in between the doc-comment and the declaration.
2020-03-31 14:27:23 +02:00
Aleksey Kladov
6b2f02fdfd Ignore createProgress request in tests
closes #3783
2020-03-31 12:02:47 +02:00
kjeremy
f633f69e36 Do not call reserve since extend will handle it.
`Take` implements `TrustedLen` so we are guaranteed that only one
reserve call will be made.
2020-03-30 17:09:21 -04:00
kjeremy
c39725212c Use more functional programming in ArenaMap::insert
I find this more readable and it flattens out the body a little.
2020-03-30 16:15:28 -04:00
bors[bot]
6f0d8db529
Merge #3775
3775: Fix typo r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-30 16:51:56 +00:00
Aleksey Kladov
beab6f34ce Fix typo 2020-03-30 18:51:30 +02:00
kjeremy
d4c317320d Simplify SemanticTokensBuilder build method
This matches the next stable vscode api
2020-03-30 12:07:27 -04:00
Kirill Bulatov
4c897d8d2d Fix the endless progress bar issue 2020-03-30 14:38:01 +03:00
Kirill Bulatov
8e78371222 Rebase fixes 2020-03-30 13:39:14 +03:00
Kirill Bulatov
2a19459ee9 Avoid failing on incorrect settings response 2020-03-30 13:39:14 +03:00
Kirill Bulatov
fbef0127ba Small style fix 2020-03-30 13:39:14 +03:00
Kirill Bulatov
b892a48740 Code review fixes
Co-Authored-By: Veetaha <veetaha2@gmail.com>
2020-03-30 13:39:14 +03:00
Kirill Bulatov
590af37bff Small style fix
Co-Authored-By: Veetaha <veetaha2@gmail.com>
2020-03-30 13:39:14 +03:00
Kirill Bulatov
392eb74b5f Remove an obsolete fixme 2020-03-30 13:39:14 +03:00
Kirill Bulatov
bbe59c7197 Reload watcher configuration 2020-03-30 13:39:14 +03:00
Kirill Bulatov
8a23bec2cd Style fixes 2020-03-30 13:39:14 +03:00
Kirill Bulatov
332799d914 Reload only the properties that do not affect vfs 2020-03-30 13:39:14 +03:00
Kirill Bulatov
2feaef91bd Read new config on the server side 2020-03-30 13:39:14 +03:00
Kirill Bulatov
019f269a0a Process configuration response draft 2020-03-30 13:39:14 +03:00
Kirill Bulatov
8c4aab0c80 Client side draft 2020-03-30 13:39:14 +03:00
Aleksey Kladov
0cfa9eb445 Use IntoIter 2020-03-30 12:28:22 +02:00
bors[bot]
d2ea3f25b5
Merge #3761
3761: Append new match arms rather than replacing all of them r=matklad a=mattyhall

This means we now retain comments when filling in match arms. This fixes #3687. This is my first contribution so apologies if it needs a rethink! I think in particular the way I find the position to append to and remove_if_only_whitespace are a little hairy.

Co-authored-by: Matthew Hall <matthew@quickbeam.me.uk>
2020-03-30 10:19:02 +00:00
bors[bot]
3901198e87
Merge #3763
3763: Simplify r=matklad a=Veetaha



Co-authored-by: veetaha <veetaha2@gmail.com>
2020-03-30 09:57:40 +00:00
Aleksey Kladov
4c9272583c Pull options outwards 2020-03-30 11:46:04 +02:00
Aleksey Kladov
12297ab675 Fix race in the tests 2020-03-30 11:33:01 +02:00
Aleksey Kladov
f7df0b56a7 Use automatic thread joining for cargo-watch 2020-03-30 11:33:01 +02:00
Edwin Cheng
36812b9d7b Fix review comments 2020-03-30 02:39:03 +08:00
Matthew Hall
ddb9cc47d1 Tidy up insertion position logic 2020-03-29 12:45:15 +01:00
Matthew Hall
b8b271d984 Remove unneeded variables 2020-03-29 12:32:01 +01:00
Edwin Cheng
dc0076de12 Move roots_to_scan to LoopState 2020-03-29 06:33:16 +08:00
veetaha
3d73345cdb Simplify 2020-03-28 23:48:37 +02:00
Matthew Hall
77bb9a56f1 Remove "TODO" in comment in test 2020-03-28 21:24:26 +00:00
Matthew Hall
ecc2615ba2 Append new match arms rather than replacing all of them
This means we now retain comments when filling in match arms.
2020-03-28 20:58:46 +00:00
Aleksey Kladov
311cbbdad5 Remove some unwraps 2020-03-28 12:27:54 +01:00
Aleksey Kladov
6596e7cddf Nice string formatting 2020-03-28 12:27:54 +01:00
Aleksey Kladov
b764c38436 Start stdx
This crate will hold everything to small to be worth publishing
2020-03-28 11:01:25 +01:00
Piotr Szpetkowski
f016d8b900
Fix merge-imports assist for wildcard imports 2020-03-27 17:28:25 +01:00
Aleksey Kladov
dc311b10f3 Fix assist description 2020-03-27 13:23:19 +01:00
bors[bot]
a4901fdcfd
Merge #3742
3742: Replace if with if-let r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-27 11:21:57 +00:00
Aleksey Kladov
91e482b46d Replace if with if-let 2020-03-27 12:15:46 +01:00
bors[bot]
f9cf86475c
Merge #3741
3741: More general ctor for ifs r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-27 10:38:31 +00:00
Aleksey Kladov
cbb53cf55c More general ctor for ifs 2020-03-27 11:38:00 +01:00
bors[bot]
31528620a8
Merge #3740
3740: Simplify r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-27 10:27:01 +00:00
Aleksey Kladov
d953df319b Simplify 2020-03-27 11:25:11 +01:00
bors[bot]
b1594f1080
Merge #3727
3727: Introduce ra_proc_macro r=matklad a=edwin0cheng

This PR implemented:

1.  Reading dylib path of proc-macro crate from cargo check , similar to how `OUTDIR` is obtained.
2.  Added a new crate `ra_proc_macro` and implement the foot-work for reading result from external proc-macro expander. 
3. Added a struct `ProcMacroClient` , which will be responsible to the client side communication to the External process.



Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-03-26 17:09:32 +00:00
Edwin Cheng
db162df264 Remove deps on tt_mbe 2020-03-27 00:46:40 +08:00
bors[bot]
20c110e57f
Merge #3732
3732: Assist: replace unwrap with match r=matklad a=unrealhoang

attempt on #3669

Co-authored-by: Unreal Hoang <unrealhoang@gmail.com>
2020-03-26 15:38:03 +00:00
Aleksey Kladov
db34abeb85 Get rid of ItemOrMacro 2020-03-26 16:10:01 +01:00
Unreal Hoang
d9df0f43ac
Assist: replace unwrap with match 2020-03-27 00:08:12 +09:00
Aleksey Kladov
b7aaefb5a4 Minor incremental tests cleanup 2020-03-26 15:44:31 +01:00
Edwin Cheng
72e68d0caf Refactoring a bit 2020-03-26 10:49:23 +08:00
Edwin Cheng
d0b6ed4441 Add ProcMacroClient 2020-03-26 03:29:45 +08:00
Aleksey Kladov
9f53cec1da Cleanup memory usage stats 2020-03-25 19:35:46 +01:00
Edwin Cheng
a617f24eae Add ra_proc_macro 2020-03-26 01:30:39 +08:00
Edwin Cheng
07ec31813c fix typo of visibility_of 2020-03-26 00:11:38 +08:00
bors[bot]
0f6fb0ec3b
Merge #3722
3722: Fix parsing lambdas with return type r=matklad a=matklad

We should eat only a single block, and not whatever larger expression
may start with a block.

closes #3721



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-25 16:01:54 +00:00
Aleksey Kladov
f6188caaa0 Fix parsing lambdas with return type
We should eat only a single block, and not whatever larger expression
may start with a block.

closes #3721
2020-03-25 17:01:28 +01:00
Aleksey Kladov
72c6fc3ff0 Fix add visibility false-positive 2020-03-25 15:55:57 +01:00
Aleksey Kladov
b3665fccfb Preserve relative ordering of grouped assists 2020-03-25 15:45:52 +01:00
bors[bot]
785eb32f49
Merge #3717
3717: Always expand macros during analysis r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-25 12:53:48 +00:00
Aleksey Kladov
2ccfb49bab Always expand macros during analysis 2020-03-25 13:53:15 +01:00
Edwin Cheng
2adc9a8d5f Remove collect proc_macro definitions 2020-03-25 20:14:22 +08:00
Edwin Cheng
5bd3aa05d6 Fix trailling whitespace 2020-03-25 19:50:12 +08:00
Edwin Cheng
8afb445357 Rename to CustomDerive 2020-03-25 19:50:12 +08:00
Edwin Cheng
7667aa6033 Refactoring a bit 2020-03-25 19:50:12 +08:00
Edwin Cheng
519dc15cb1 Use dummy implementation 2020-03-25 19:50:12 +08:00
Edwin Cheng
34dc8d25c1 Add basic custom derive lowering 2020-03-25 19:50:12 +08:00
Aleksey Kladov
f7f0f33e05 Remove dead code 2020-03-25 10:09:50 +01:00
bors[bot]
8a73a8937d
Merge #3707
3707: Add ItemScope::visibility_of r=matklad a=edwin0cheng

~This PR implements `HasVisibility` for various constructs and change `Definition::search_scope` to use `Visibility` directly instead of depends on ad-hoc string parsing.~

This PR added `visibility_of`  in `ItemScope` and `Module` and use it directly directly instead of depends on ad-hoc string parsing.

And also add a FIXME to indicate that there is a bug which do not search child-submodules in other files recursively in `Definition::search_scope`.

I will submit another PR to fix that bug after this is merged.

cc @flodiebold 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-03-25 08:09:26 +00:00
Matt Hooper
7b35da04bf Improvements based on code review feedback 2020-03-25 00:18:55 +01:00
Matt Hooper
9d298115a6 Fmt corrections 2020-03-24 23:22:41 +01:00
Matt Hooper
b70ce559b8 Added more unit tests 2020-03-24 23:22:41 +01:00
Matt Hooper
a197abbc7a Added new inlay hint kind and rules for method chaining 2020-03-24 23:18:42 +01:00
Edwin Cheng
d606521723 Use visibility_of in search 2020-03-25 04:45:55 +08:00
Edwin Cheng
bcfb3700ce Add ItemScope::visibility_of 2020-03-25 04:45:42 +08:00
bors[bot]
fae627174a
Merge #3664
3664: Introduce TokenConverter Trait r=matklad a=edwin0cheng

This PR add a `TokenConverter` Trait to share the conversion logic between raw `lexer` token and Syntax Node Token.

Related #2158.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-03-24 16:41:56 +00:00
bors[bot]
9690f6bc43
Merge #3708
3708: Generalise syntax rewriting infrastructure to allow removal of nodes r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-24 16:15:08 +00:00
Aleksey Kladov
062f6e3bbe Generalise syntax rewriting infrastructure to allow removal of nodes 2020-03-24 17:14:33 +01:00
bors[bot]
7c2cc85806
Merge #3705
3705: Align naming r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-24 11:56:43 +00:00
Aleksey Kladov
9bf2cd609c Align naming 2020-03-24 12:56:07 +01:00
bors[bot]
6ef64622af
Merge #3700
3700: fill match arms with empty block rather than unit tuple r=matklad a=JoshMcguigan

As requested by @Veetaha in #3689 and #3687, this modifies the fill match arms assist to create match arms as an empty block `{}` rather than a unit tuple `()`.

In one test I left one of the pre-existing match arms as a unit tuple, and added a body to another match arm, to demonstrate that the contents of existing match arms persist. 

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2020-03-24 11:48:32 +00:00
bors[bot]
8617fe641d
Merge #3694
3694: Complete only missing fields r=matklad a=SomeoneToIgnore



Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-03-24 09:49:25 +00:00
Kirill Bulatov
f1cf1cc1ca Code review fixes
Co-Authored-By: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-24 11:33:47 +02:00
bors[bot]
c6db6e2352
Merge #3696 #3698 #3703
3696: vscode: more type safety r=matklad a=Veetaha



3698: Consider references when applying postfix completions r=matklad a=SomeoneToIgnore

Sometimes my RA debugging workflow breaks because `.dbg` is applied to the variable that is used later in the code.
It's safer to consider the refences to avoid this for completions that may trigger the move.

3703: Don't try to enable proposed API's on stable r=matklad a=matklad



bors r+
🤖

Co-authored-by: veetaha <veetaha2@gmail.com>
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-24 08:54:30 +00:00
Kirill Bulatov
dd3b64124b Add a test 2020-03-24 10:43:24 +02:00
Kirill Bulatov
944f28fe5b Use more generic public api 2020-03-24 10:43:22 +02:00
Kirill Bulatov
d5e11b33a3 Remove the upcast 2020-03-24 10:43:00 +02:00
Kirill Bulatov
d221ff4f9e Auto import macros 2020-03-24 10:43:00 +02:00
Josh Mcguigan
7ba934fe58 fill match arms with empty block rather than unit tuple 2020-03-23 19:23:30 -07:00
Kirill Bulatov
4e43df26b2 Consider references when applying postfix completions 2020-03-24 01:56:06 +02:00
Josh Mcguigan
df58ab8963 update itertools version to 0.9.0 2020-03-23 16:22:46 -07:00
Kirill Bulatov
00cbe81a5b Complete only missing fields 2020-03-24 00:36:06 +02:00
Aleksey Kladov
3bd119a4c1 Add a test 2020-03-23 20:57:42 +01:00
bors[bot]
eff1b3fe4d
Merge #3689
3689: implement fill match arm assist for tuple of enums r=matklad a=JoshMcguigan

This updates the fill match arm assist to work in cases where the user is matching on a tuple of enums. 

Note, for now this does not apply when some match arms exist (other than the trivial `_`), but I think this could be added in the future.

I think this also lays the groundwork for filling match arms when matching on tuples of non-enum values, for example a tuple of an enum and a boolean.

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2020-03-23 16:41:46 +00:00
Aleksey Kladov
f8fd242199
Merge pull request #3686 from Veetaha/feature/hover-actual-type-params
ra_hir: add more privacy for Type
2020-03-23 14:06:54 +01:00
Aleksey Kladov
a2f7ca27c0
Merge pull request #3678 from edwin0cheng/refactor-rename
Fix rename argument in macro call
2020-03-23 14:06:40 +01:00
Josh Mcguigan
bc48c9d511 review comments 2020-03-23 05:19:09 -07:00
bors[bot]
851a03492e
Merge #3690
3690: ra_hir: add more docs r=matklad a=Veetaha

Cited from [hear](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/hover/near/191446937)

Co-authored-by: veetaha <veetaha2@gmail.com>
2020-03-23 12:06:11 +00:00
veetaha
e6691844db ra_hir: fix typo 2020-03-23 14:04:50 +02:00
veetaha
0fc21bd303 ra_hir: add more docs 2020-03-23 14:00:51 +02:00
bors[bot]
a27f5e3e05
Merge #3632
3632: ra_cargo_watch: log errors r=matklad a=Veetaha

Until this moment we totally ignored all the errors from cargo process. Though this is still true, but we
now try to log ones that are critical (i.e. misconfiguration errors and ignore compile errors).

This fixes #3631, and gives us a better error message to more gracefully handle the #3265
![image](https://user-images.githubusercontent.com/36276403/76958683-d7e1f080-6920-11ea-83d8-04561c11ccc4.png)

Though I think that outputting this only to `Output` channel is not enough. We should somehow warn the user that he passed wrong arguments to `cargo-watch.args`. I didn't bother looking for how to do this now, but this PR at least gives us something.

*cc* @kiljacken @matklad 

Co-authored-by: veetaha <veetaha2@gmail.com>
Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-03-23 11:55:26 +00:00
bors[bot]
c7a2052e73
Merge #3681
3681: Only include machine-applicable suggestions r=kiljacken a=lnicola

Fixes #3676
Fixes #3633
Fixes #3391 

r? @kiljacken

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-03-23 11:41:32 +00:00
Josh Mcguigan
2afccbe477 implement fill match arm assist for tuple of enums 2020-03-22 23:28:25 -07:00
veetaha
559aeb2932 ra_hir: add more privacy for Type 2020-03-23 02:01:07 +02:00
bors[bot]
baa11d52f4
Merge #3684
3684: ra_hir_def: fix typo r=edwin0cheng a=Veetaha



Co-authored-by: veetaha <veetaha2@gmail.com>
2020-03-22 19:59:05 +00:00
veetaha
dc1fbef985 ra_hir_def: fix typo 2020-03-22 19:38:55 +02:00
bors[bot]
9328aba706
Merge #3677
3677: Add support for macro in symbol_index r=kjeremy a=edwin0cheng

This PR allows macro showing up in `Open symbol` search:

![show_macro](https://user-images.githubusercontent.com/11014119/77244297-548d0b80-6c4e-11ea-8613-15926cc297b3.png)


Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-03-22 14:50:42 +00:00
Laurențiu Nicola
96da53fc56 Only include machine-applicable suggestions 2020-03-22 16:45:15 +02:00
bors[bot]
655b4f16f0
Merge #3679
3679: Some miniscule refactorings r=matklad a=Veetaha



Co-authored-by: veetaha <veetaha2@gmail.com>
2020-03-22 14:17:06 +00:00
Edwin Cheng
af8c37cb57
Fix typo
Co-Authored-By: Veetaha <veetaha2@gmail.com>
2020-03-22 22:01:48 +08:00
veetaha
bfb6e3fd83 ra_hir: migrate some stuff to matches!() 2020-03-22 15:45:32 +02:00
veetaha
a8e5da8a70 ra_hir_ty: fix formatting 2020-03-22 15:44:38 +02:00
Edwin Cheng
6d5443ef94 Add test 2020-03-22 19:53:34 +08:00
Edwin Cheng
cba4dd1a8a Improve find_all_ref work inside macro 2020-03-22 19:53:28 +08:00
Edwin Cheng
f647faac60 Refactor search 2020-03-22 19:52:45 +08:00
Edwin Cheng
532e178f8e Add find_node_at_offset_with_descend 2020-03-22 19:52:14 +08:00
veetaha
8be28a2d4f ra_cargo_watch: log exit code too 2020-03-22 12:01:49 +02:00
Edwin Cheng
bb22a4e386 Add support for macro in symbo_index 2020-03-22 15:00:44 +08:00
Veetaha
788b29d343
Smol self-nit 2020-03-22 01:27:03 +02:00
bors[bot]
6fe956420f
Merge #3673
3673: Add recursive limit for macro expansion when expanding expression r=flodiebold a=edwin0cheng

cc @flodiebold 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-03-21 22:39:06 +00:00
veetaha
8414342640 fix: typo 2020-03-21 23:37:15 +02:00
veetaha
ce73c43848 ra_cargo_watch: return Result<> from run_cargo(), and don't read stderr for now
As stated by matklad, reading the stderr
should be done alngside with
stdout via select() (or I guess poll()),
there is no such implementation in stdlib,
since it is quite low level and platform-dependent and it
also requires quite a bit of unrelated code we don't use it for now.

As referenced by bjorn3, there is an implementation of the needed read2() function
in rustc compiletest. The better solution will be to extract this function
to a separate crate in future:
https://github.com/rust-analyzer/rust-analyzer/pull/3632#discussion_r395605298
2020-03-21 23:37:15 +02:00
veetaha
59ba386bee ra_cargo_watch: log more errors 2020-03-21 23:36:31 +02:00
Edwin Cheng
d62dd63256 Use target-name for crate-name 2020-03-22 01:09:38 +08:00
bors[bot]
50c6a315ab
Merge #3671
3671: Add identity expansion checking in ill-form expansion  r=flodiebold a=edwin0cheng

This PR try to add more checking code in error case in macro expansion. The bug in #3642 is introduced by  #3580 , which allow ill-form macro expansion in *all* kind of macro expansions. 

In general we should separate hypothetical macro expansion and the actual macro expansion call. However, currently the `Semantic`  workflow we are using only support single macro expansion type, we might want to review it and make it works in both ways. (Maybe add a field in `MacroCallLoc` for differentiation) 

Fix #3642

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-03-21 16:02:07 +00:00
Edwin Cheng
92cc6c9816 Add recursive limit in expression macro expansion 2020-03-21 23:58:47 +08:00
Edwin Cheng
9ff50d7e83 Move test to hir_ty 2020-03-21 23:41:07 +08:00
Edwin Cheng
6d6606895c Fix typo 2020-03-21 23:08:53 +08:00
Edwin Cheng
e1a9461806 Add identity expansion checking 2020-03-21 22:43:48 +08:00
Josh Mcguigan
c3702a6b71 disable invert if assist for if-let to fix #3281 2020-03-21 06:40:18 -07:00
Edwin Cheng
adc54632ae Add open delim when delim not match 2020-03-21 05:20:28 +08:00
Edwin Cheng
6bcaa1d7d1 Fix text range bug and reorder 2020-03-21 04:57:20 +08:00
Edwin Cheng
622c843a4c Add TokenConvertor trait 2020-03-21 03:08:56 +08:00
Edwin Cheng
27c516970b Add test for delim bug 2020-03-20 23:36:29 +08:00
bors[bot]
467a040509
Merge #3623
3623: 'Fill match arms' should work with existing match arms r=matklad a=slyngbaek

Addresses #3039

This essentially adds missing match arms. The algorithm for this
can get complicated rather quickly so bail in certain conditions
and rely on a PlaceholderPat.

The algorighm works as such:
- Iterate through the Enum Def Variants
- Attempt to see if the variant already exists as a match arm
- If yes, skip the enum variant. If no, include it.
- If it becomes complicated, rather than exhaustively deal with every
  branch, mark it as a "partial match" and simply include the
  placeholder.

  Conditions for "complication":
  - The match arm contains a match guard
  - Any kind of nested destrucuring

Order the resulting merged match branches as such:
1. Provided match arms
2. Missing enum variant branch arms
3. End with Placeholder if required

- Add extra tests

Co-authored-by: Steffen Lyngbaek <steffenlyngbaek@gmail.com>
2020-03-20 08:26:15 +00:00
bors[bot]
e0952899ae
Merge #3662
3662: Support arbitrary discriminants r=matklad a=matklad

Closes #3661



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-20 07:51:24 +00:00
Aleksey Kladov
89694ec8f6 Support arbitrary discriminants
Closes #3661
2020-03-20 08:50:34 +01:00
Steffen Lyngbaek
ec24c09006 Remove const
- Add test for @ matching
- Address comments
2020-03-19 14:17:34 -07:00