Commit Graph

5872 Commits

Author SHA1 Message Date
Aleksey Kladov
b8eb1597c9 Use Expander for cfg handling in structs 2020-04-11 17:17:12 +02:00
Aleksey Kladov
ac21100f32 Use Expander for cfg handling in impls 2020-04-11 17:12:17 +02:00
Aleksey Kladov
e9519e1035 Pull Expander up 2020-04-11 17:09:50 +02:00
Aleksey Kladov
6b0870d12e Simplify 2020-04-11 17:00:31 +02:00
Aleksey Kladov
997c959d4f
Merge pull request #3935 from cjhopman/todo
Change missing impl assist to use todo!() instead of unimplemented()
2020-04-11 16:05:23 +02:00
Aleksey Kladov
8bd14a3483
Merge pull request #3910 from lnicola/fn-named-param-hint
Hide parameter hints for single-argument functions with the same name
2020-04-11 14:48:14 +02:00
bors[bot]
0ecdba20df
Merge #3920
3920: Implement expand_task and list_macros in proc_macro_srv r=matklad a=edwin0cheng

This PR finish up the remain `proc_macro_srv` implementation :

1. Added dylib loading code for proc-macro crate dylib. Note that we have to add some special flags for unix loading because of a bug in old version of glibc, see https://github.com/fedochet/rust-proc-macro-panic-inside-panic-expample/issues/1 and https://github.com/rust-lang/rust/issues/60593 for details.

2. Added tests for proc-macro expansion: We use a trick here by adding `serde_derive` to dev-dependencies and calling `cargo-metadata` for searching its dylib path, and expand it in our tests. 

[EDIT]
Note that this PR **DO NOT** implement the final glue code with rust-analzyer and proc-macro-srv yet.
 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-04-11 11:49:07 +00:00
Edwin Cheng
73e512215a Fix non canonicallized path for crate file 2020-04-11 18:12:50 +08:00
Edwin Cheng
31d163aa3b Improve error handling 2020-04-11 14:53:13 +08:00
Aleksey Kladov
c1244c853c Forward compat 2020-04-11 00:27:00 +02:00
Chris Hopman
af04d45d32 Change missing impl assist to use todo!() instead of unimplemented()
todo!() "Indicates unfinished code" (https://doc.rust-lang.org/std/macro.todo.html)

Rust documentation provides further clarification:

> The difference between unimplemented! and todo! is that while todo!
> conveys an intent of implementing the functionality later and the
> message is "not yet implemented", unimplemented! makes no such claims.

todo!() seems more appropriate for assists that insert missing impls.
2020-04-10 13:56:12 -07:00
Aleksey Kladov
1b68c72fe9 Move timeit to stdx 2020-04-10 20:46:42 +02:00
Aleksey Kladov
72a0db8dc4 profile queries 2020-04-10 20:25:55 +02:00
Aleksey Kladov
428d4dfe71 Fix accidently quadratic behavior when processing includes
closes #3927
2020-04-10 19:43:37 +02:00
Aleksey Kladov
5e2f29af85 Add failing test 2020-04-10 19:43:37 +02:00
Aleksey Kladov
c476742f47 Simplify 2020-04-10 17:47:49 +02:00
Aleksey Kladov
5c5bde47fb Rename some tokens 2020-04-10 17:07:09 +02:00
Aleksey Kladov
d4332760d8 Better readability 2020-04-10 16:10:28 +02:00
Aleksey Kladov
e0f02d233f Remove dead code 2020-04-10 16:10:28 +02:00
Aleksey Kladov
4560fe2abf Generate only minimal set of ineresting tokens 2020-04-10 16:10:28 +02:00
Aleksey Kladov
8d71a6bf0c Scale token generation back 2020-04-10 16:10:28 +02:00
Aleksey Kladov
779f06ed77 Convert more tokens 2020-04-10 16:10:28 +02:00
Aleksey Kladov
548f562dda Other delimiters 2020-04-10 16:10:28 +02:00
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
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
Edwin Cheng
5fc8f90a21 tidy up a bit 2020-04-10 19:08:15 +08: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
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