Commit graph

9221 commits

Author SHA1 Message Date
Aleksey Kladov
460c8bbdec Curley tokens 2020-04-10 16:10:28 +02:00
Aleksey Kladov
1c5d859195 Start replacing tokens 2020-04-10 16:10:28 +02:00
Aleksey Kladov
c8b4c36f81 Semicolon token 2020-04-10 16:10:28 +02:00
Aleksey Kladov
f89f2e3885 More readable ast_src for keywords 2020-04-10 16:10:28 +02:00
Aleksey Kladov
ff5643c524 Simplify 2020-04-10 16:10:27 +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
bors[bot]
0a891d19ae
Merge #3748
3748: Implement Chalk's debug methods using TLS r=matklad a=flodiebold

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. I think this is sound, but I still don't really want to do it this way...

Having names in the Chalk debug output is very nice, but maybe IDs will have to suffice 😞 

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-04-10 13:25:24 +00: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
Edwin Cheng
5fc8f90a21 tidy up a bit 2020-04-10 19:08:15 +08:00
Geoffrey Copin
730a927c5e Implement assist "Reorder field names" 2020-04-10 00:57:03 +02:00
bors[bot]
176f7f6117
Merge #3923
3923: Cleanup keyword accessors r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-09 21:47:34 +00:00
Aleksey Kladov
30084a56a5 Simpler acessors for keywords 2020-04-09 23:42:01 +02:00
Aleksey Kladov
00ec0c1066 use uniform accessor 2020-04-09 23:19:51 +02:00
Aleksey Kladov
046a021013 use stdx 2020-04-09 23:05:13 +02:00
Aleksey Kladov
0ed27c388a Drop needless trait 2020-04-09 23:02:10 +02:00
bors[bot]
eb07803e81
Merge #3922
3922: Remove code duplication r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-09 20:23:27 +00:00
Aleksey Kladov
e07d3c94de Remove code duplication 2020-04-09 22:22:58 +02:00
Edwin Cheng
857c03df07 Fix macos symbol name bug 2020-04-10 04:09:11 +08: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
Laurențiu Nicola
81aab500c6 Hide parameter hints for single-argument functions with the same name 2020-04-09 21:47:04 +03:00
bors[bot]
9635d8bc44
Merge #3901
3901: Add more heuristics for hiding obvious param hints r=matklad a=IceSentry

This will now hide `value`, `pat`, `rhs` and `other`. These words were selected from the std because they are used in commonly used functions with only a single param and are obvious by their use.

It will also hide the hint if the passed param **starts** or end with the param_name. Maybe we could also split on '_' and check if one of the string is the param_name.

I think it would be good to also hide `bytes` if the type is `[u8; n]` but I'm not sure how to get the param type signature.

Closes #3900 



Co-authored-by: IceSentry <c.giguere42@gmail.com>
2020-04-09 18:07:28 +00:00
Edwin Cheng
197039b9fe Remove allow(unused) 2020-04-10 02:06:14 +08:00
Edwin Cheng
460ddde176 Add tests 2020-04-10 02:05:54 +08:00
Edwin Cheng
e5698faf4c Implement expand_task and list_macros 2020-04-10 01:18:47 +08:00
Edwin Cheng
f7f121d60d Add dylib loading code 2020-04-10 01:18:47 +08: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
bors[bot]
dde9488559
Merge #3919
3919: Refactor tokena accessors r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-09 16:54:14 +00:00
Aleksey Kladov
2bfb65db93 Be consistent about token accesors 2020-04-09 18:48:13 +02:00
bors[bot]
4cea01fdf8
Merge #3917
3917: Improve tt::Subtree debug print r=matklad a=edwin0cheng



Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-04-09 16:39:19 +00: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
IceSentry
ebc61709c8 use .expr() to remove ref 2020-04-09 12:26:49 -04: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
Aleksey Kladov
a95116fbfa Simplify 2020-04-09 18:20:06 +02:00
Edwin Cheng
19d952c603 Improve tt::Subtree debug print 2020-04-10 00:17:32 +08:00
bors[bot]
30f0ad159a
Merge #3915
3915: Prettify generated code r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-09 16:15:21 +00:00
Aleksey Kladov
56c8581b90 Put displays at the end 2020-04-09 18:11:16 +02:00
Aleksey Kladov
9285cbffb6 More compact 2020-04-09 18:08:54 +02:00
Aleksey Kladov
6fd2a12495 More compact generated code 2020-04-09 18:07:16 +02:00
Aleksey Kladov
4a063e651f Move the rest of the tokens to generated/tokens 2020-04-09 17:58:15 +02:00
Aleksey Kladov
c80795e274 Move generated tokens to a separate file 2020-04-09 17:47:46 +02:00
IceSentry
ae416f3c6e clean up param hint checking 2020-04-09 10:35:07 -04:00
Aleksey Kladov
59b6b2278b Start ast/generated/tokens 2020-04-09 16:25:06 +02:00
Aleksey Kladov
d61932ef7e Prepare for spliting generated into tokens and nodes 2020-04-09 16:17:18 +02:00
Aleksey Kladov
0fc8c5cca0 Reduce visibility 2020-04-09 15:49:17 +02:00
Aleksey Kladov
6379061e21 Cleanup import 2020-04-09 15:47:48 +02:00
bors[bot]
d416d892fc
Merge #3913
3913: Remove allocations from LCA r=matklad a=matklad

I haven't actually profiled this, but not allocating a hash map (or
anything, really) seems like a good idea



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-09 11:58:15 +00:00
Aleksey Kladov
738fc79c92 Remove allocations from LCA
I haven't actually profiled this, but not allocating a hash map (or
anything, really) seems like a good idea
2020-04-09 13:56:45 +02:00
bors[bot]
1647d5ac60
Merge #3912
3912: Parse correctly fn f<T>() where T: Fn() -> u8 + Send {} r=matklad a=matklad

We used to parse it as T: Fn() -> (u8 + Send), which is different from
the rustc behavior of T: (Fn() -> u8) + Send



bors r+
🤖

Co-authored-by: Luca Barbieri <luca@luca-barbieri.com>
2020-04-09 11:09:19 +00:00
Luca Barbieri
74e3b48806 Parse correctly fn f<T>() where T: Fn() -> u8 + Send {}
We used to parse it as T: Fn() -> (u8 + Send), which is different from
the rustc behavior of T: (Fn() -> u8) + Send
2020-04-09 13:05:41 +02:00