Commit Graph

252 Commits

Author SHA1 Message Date
Aleksey Kladov
c1244c853c Forward compat 2020-04-11 00:27:00 +02:00
Aleksey Kladov
5e2f29af85 Add failing test 2020-04-10 19:43:37 +02:00
bors[bot]
38e0d0f334
Merge #3905
3905: add ellipsis field to hir pat record r=matklad a=JoshMcguigan

This PR corrects a `fixme`, adding an `ellipsis` field to the hir `Pat::Record` type. It will also be unlock some useful follow on work for #3894.

Additionally it adds a diagnostic for missing fields in record patterns.

~~Marking as a draft because I don't have any tests, and a small amount of manual testing on my branch from #3894 suggests it might *not* be working. Any thoughts on how I can best test this, or else pointers on where I might be going wrong?~~

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2020-04-10 13:52:25 +00:00
Josh Mcguigan
e63315b8f1 add record pat missing field diagnostic 2020-04-10 06:35:52 -07:00
Florian Diebold
a0a80a4103 Implement Chalk's debug methods using TLS
Chalk now panics if we don't implement these methods and run with CHALK_DEBUG,
so I thought I'd try to implement them 'properly'. Sadly, it seems impossible to
do without transmuting lifetimes somewhere. The problem is that we need a `&dyn
HirDatabase` to get names etc., which we can't just put into TLS. I thought I
could just use `scoped-tls`, but that doesn't support references to unsized
types. So I put the `&dyn` into another struct and put the reference to *that*
into the TLS, but I have to transmute the lifetime to 'static for that to work.
2020-04-10 15:04:06 +02:00
Aleksey Kladov
30084a56a5 Simpler acessors for keywords 2020-04-09 23:42:01 +02:00
bors[bot]
33df20868d
Merge #3918
3918: Add support for feature attributes in struct literal r=matklad a=bnjjj

As promised here is the next PR to solve 2 different scenarios with feature flag on struct literal.
close #3870 

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-09 19:27:06 +00:00
Benjamin Coenen
c1317d6923 feat: add support for feature attributes in struct literal
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-09 19:12:50 +02:00
Benjamin Coenen
fc70cf9458 feat: add support for feature attributes in struct literal
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-09 18:32:02 +02:00
Aleksey Kladov
e6d22187a6 Add _token suffix to token accessors
I think this makes is more clear which things are : AstNode and which
are : AstToken
2020-04-09 18:25:36 +02:00
Luca Barbieri
60f4d7bd8c Provide more complete AST accessors to support usage in rustc 2020-04-09 11:50:37 +02:00
Benjamin Coenen
585bb83e2a feat: add attributes support on struct fields and method #3870
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-09 09:53:53 +02:00
Josh Mcguigan
36c110ee09 match checking add additional test for match checking tuple with missing pattern 2020-04-08 10:47:05 -07:00
Josh Mcguigan
941615748d fix panic in match checking when tuple enum missing pattern 2020-04-08 10:47:05 -07:00
Benjamin Coenen
8f1dba6f9a feat: add attributes support on struct fields and method #3870
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-08 18:12:15 +02:00
Aleksey Kladov
4c29214bba Move computation of missing fields into hir 2020-04-07 18:34:17 +02:00
Benjamin Coenen
18a5e16483 Merge branch 'master' of github.com:rust-analyzer/rust-analyzer 2020-04-07 17:59:09 +02:00
Benjamin Coenen
ab864ed259 feat: add attributes support on struct fields #3870
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-07 17:58:05 +02:00
Josh Mcguigan
9fc1f51b7a add fixme to use type checker rather than manually comparing types 2020-04-07 05:17:59 -07:00
Josh Mcguigan
a208de15b7 PR feedback implementation 2020-04-07 05:12:08 -07:00
Josh Mcguigan
da6752d5f9 missing match arms diagnostic change source to match expression 2020-04-07 05:12:08 -07:00
Josh Mcguigan
5fe608fb31 handle match auto-deref 2020-04-07 05:12:08 -07:00
Josh Mcguigan
5b4316377b improving documentation 2020-04-07 05:12:08 -07:00
Josh Mcguigan
43dfd89493 handle non matching enum pattern types 2020-04-07 05:12:08 -07:00
Josh Mcguigan
b87b7a088f remove panics 2020-04-07 05:12:08 -07:00
Josh Mcguigan
8c378af721 missing match arms diagnostic 2020-04-07 05:12:08 -07:00
Florian Diebold
236ac630f6 Fix Chalk panic
Fixes #3865. Basically I forgot to shift 'back' when we got `dyn Trait`s back
from Chalk, so after going through Chalk a few times, the panic happened.
2020-04-06 17:26:26 +02:00
Aleksey Kladov
bf569f8b29 Check for eprintln on CI 2020-04-06 17:00:18 +02:00
Edwin Cheng
a569a19ef4 Use log info in trait_solve_query 2020-04-06 21:01:58 +08:00
bors[bot]
a93a04fc9e
Merge #3744
3744: Upgrade Chalk r=matklad a=flodiebold



Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-04-06 07:49:09 +00:00
Laurențiu Nicola
7d62280a71 Hide unit fn return types 2020-04-05 21:06:47 +03:00
Florian Diebold
952714685a Upgrade Chalk again
The big change here is counting binders, not
variables (https://github.com/rust-lang/chalk/pull/360). We have to adapt to the
same scheme for our `Ty::Bound`. It's mostly fine though, even makes some things
more clear.
2020-04-05 19:23:18 +02:00
Florian Diebold
3659502816 Upgrade Chalk 2020-04-05 19:23:18 +02:00
Laurențiu Nicola
b58a7f41f1 Fix inference of function pointer return types 2020-04-05 18:18:40 +03:00
Aleksey Kladov
da8eb29a2f Macro patterns are not confused with expressions.
We treat macro calls as expressions (there's appropriate Into impl),
which causes problem if there's expresison and non-expression macro in
the same node (like in the match arm).

We fix this problem by nesting macor patterns into another node (the
same way we nest path into PathExpr or PathPat). Ideally, we probably
should add a similar nesting for macro expressions, but that needs
some careful thinking about macros in blocks: `{ am_i_expression!() }`.
2020-04-03 16:12:38 +02:00
Florian Diebold
b392a732d3 Add inference for literal and range patterns 2020-04-01 20:27:47 +02:00
veetaha
611adc83da Simplify 2020-03-31 19:00:23 +03:00
veetaha
3d73345cdb Simplify 2020-03-28 23:48:37 +02: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
9f53cec1da Cleanup memory usage stats 2020-03-25 19:35:46 +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
34dc8d25c1 Add basic custom derive lowering 2020-03-25 19:50:12 +08: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
veetaha
a8e5da8a70 ra_hir_ty: fix formatting 2020-03-22 15:44:38 +02:00
Edwin Cheng
9ff50d7e83 Move test to hir_ty 2020-03-21 23:41:07 +08:00
Florian Diebold
b973158aeb Make MBE expansion more resilient (WIP) 2020-03-16 18:38:19 +01:00
Aleksey Kladov
9faea2364d Use dyn Trait for working with databse
It improves compile time in `--release` mode quite a bit, it doesn't
really slow things down and, conceptually, it seems closer to what we
want the physical architecture to look like (we don't want to
monomorphise EVERYTHING in a single leaf crate).
2020-03-16 17:42:30 +01:00
Edwin Cheng
fe78a14bbb Support local macro_rules 2020-03-14 14:25:51 +08:00