Commit Graph

3608 Commits

Author SHA1 Message Date
Edwin Cheng
bb84fce1a4 Remove unused print out 2019-04-22 20:21:14 +08:00
Edwin Cheng
1cdfc38066 Add a test for #1178 case 2019-04-22 20:14:46 +08:00
bors[bot]
76e0129a21 Merge #1192
1192: Add mbe expand limit and poision macro set r=maklad a=edwin0cheng

As discussed in Zulip, this PR add a token expansion limit in `parse_macro` and a "poison" macro set in `CrateDefMap` to prevent stack over flow and limit a mbe macro size.

Note:
Right now it only handle a poison macro in a single crate, such that if other crate try to call that macro, the whole process will do again until it became poisoned in that crate.


Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-04-22 09:39:20 +00:00
Edwin Cheng
ad1c3b5bd6 Use map, sum in Subtree::coount instead of fold 2019-04-22 17:37:27 +08:00
Edwin Cheng
d6d9aa2003 Change macro stack monitor test to func ptr based 2019-04-22 17:15:22 +08:00
Edwin Cheng
b177813f3b Add mbe expand limit and poision macro set 2019-04-22 15:33:55 +08:00
bors[bot]
bbc5c1d24e Merge #1189
1189: Fix #1178 r=matklad a=edwin0cheng

This PR improves / fixes mbe :

1. Fixed a offest bug in `SourceTreeWalker`
2. Handle `*+` matcher properly
3. Add missing separator in rhs macro expansion.
4. Fixed bug in single token with empty delimiter subtree case. It is because the current `mbe_expander` will create an delimiter subtree for each expansion. But in `tt` case, all puncts expansion will be incorrect because of it. 
5. Fixed lifetime bug
6. Add more information on parse_macro fail
7. Add tests for above.



Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-04-21 21:28:06 +00:00
Edwin Cheng
120bfde3c2 Add tests 2019-04-22 05:04:37 +08:00
Edwin Cheng
3d1cdc834d Fix offset bug in SourceWalker 2019-04-22 05:04:37 +08:00
Edwin Cheng
49c9686c3c Handle *+ case and single token case 2019-04-22 05:04:37 +08:00
Edwin Cheng
bcf5cf8ac6 fix mbe_parser rhs colon parsing 2019-04-22 05:04:37 +08:00
Edwin Cheng
9a5b9638c1 Add more information on parse_macro fail 2019-04-22 05:04:37 +08:00
Edwin Cheng
da05bbcfb1 Fix lifetime in tt to syntax node conversion 2019-04-22 05:04:36 +08:00
bors[bot]
ee94edc722 Merge #1186
1186: remove appveyor r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-04-21 16:26:25 +00:00
Aleksey Kladov
7ef6b9e5f9 remove appveyor 2019-04-21 19:26:01 +03:00
bors[bot]
5e1c29543c Merge #1182
1182: Add HIR for where clauses & ignore impls with where clauses in trait resolution r=matklad a=flodiebold

This prevents any `impl<T> Trait for T where ...` from being treated as a
blanket impl while we don't handle where clauses yet.


Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-04-21 13:01:48 +00:00
Florian Diebold
787fb3e5ec Add HIR for where clauses & ignore impls with where clauses in trait resolution
This prevents any `impl<T> Trait for T where ...` from being treated as a
blanket impl while we don't handle where clauses yet.
2019-04-21 15:01:17 +02:00
bors[bot]
7f94119171 Merge #1181
1181: ⬆️ lsp r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-04-21 12:17:50 +00:00
Aleksey Kladov
47672726d8 ⬆️ lsp 2019-04-21 15:17:22 +03:00
bors[bot]
fa15c4d75e Merge #1175
1175: Fix bugs and add error log about macro expansion r=matklad a=edwin0cheng

This PR fixed / add following things:

* Add a fused count which stop recursion of macro expansion in name resolution.
* Add some logs when macro expansion fails
* Add `$crate` meta variable support in mbe, which create a `$crate` ident token in token tree.
* Fixed matching a `$REPEAT` pattern inside a subtree, e.g. `(fn $name:ident {$($i:ident)*} ) => {...}`
* Remove composite-able punct token in syntax node to token conversion. 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-04-21 10:34:07 +00:00
Aleksey Kladov
493bf20b3d fix docs 2019-04-21 12:52:54 +03:00
bors[bot]
57608ecd9d Merge #1179
1179: switch to official extend selection API r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-04-21 09:14:10 +00:00
Aleksey Kladov
fa12ed2b8f switch to official extend selection API 2019-04-21 12:13:48 +03:00
bors[bot]
31b7697cf6 Merge #1177
1177: ⬆️ code r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-04-21 08:33:11 +00:00
Aleksey Kladov
bf7cdec9dd ⬆️ code 2019-04-21 11:32:48 +03:00
bors[bot]
e4a58ee1f4 Merge #1176
1176: Add a simple test for str method completion r=flodiebold a=flodiebold

Somehow I forgot that we should add a test for this in #1154 until after it was already merging. So I'll just add one now :)

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-04-20 16:31:37 +00:00
Florian Diebold
82751f8a4a Add a simple test for str method completion 2019-04-20 18:26:53 +02:00
bors[bot]
4ad2e4ce4e Merge #1154
1154: Initial support for lang items (and str completion) r=flodiebold a=marcogroppo

This PR adds partial support for lang items.
For now, the only supported lang items are the ones that target an impl block.

Lang items are now resolved during type inference - this means that `str` completion now works.

Fixes #1139.

(thanks Florian Diebold for the help!)


Co-authored-by: Marco Groppo <marco.groppo@gmail.com>
2019-04-20 16:13:50 +00:00
Edwin Cheng
9e35bf91b8 Fix bugs 2019-04-20 23:53:39 +08:00
bors[bot]
526a6aba10 Merge #1174
1174: improve cargo watch r=matklad a=vemoo

- Add start and stop commands
- Cleanup trypescript code to avoid definite assignment assertions (`!` after possibly undefined value)
- Recover `rustc-watch` problem matcher because it's still useful, can be used with any command, for example `cargo test`

Co-authored-by: Bernardo <berublan@gmail.com>
2019-04-20 14:02:36 +00:00
Bernardo
4cd0a96c96 update user docs 2019-04-20 10:02:23 +02:00
Marco Groppo
8ac3d1f9aa lang_item_lookup is now a salsa query. 2019-04-20 00:29:16 +02:00
Marco Groppo
8ebb20edce New krate() method in Resolver.
Renamed Impl to ImplBlock.
2019-04-20 00:20:26 +02:00
Marco Groppo
e85ee60c42 Initial support for lang items. 2019-04-20 00:10:19 +02:00
Bernardo
422f4ac080 start cargo watch if not started interactively 2019-04-19 20:54:36 +02:00
Bernardo
3d3adabbef recover rustc-watch problemMatchers 2019-04-19 20:54:36 +02:00
Bernardo
1ae6571762 cargo watch start and stop commands 2019-04-19 20:54:36 +02:00
bors[bot]
0d39b1c3fa Merge #1172
1172: Temporarily disable tt matcher r=edwin0cheng a=edwin0cheng

Temporarily fix for #1170 by disable the `tt` matcher. The reason for that is normally a `$($tt:tt))* wildcard matcher will be added for recurisve macro. If we have any bugs in macro expansion, the macro will infinite expanding recursively. 

Let me add a fused system and add more test in later PR and then re-enable this one

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-04-19 18:41:55 +00:00
Edwin Cheng
210c762fe6 Disable test_tt_xx 2019-04-20 02:41:13 +08:00
Edwin Cheng
41c1a639c3 Disable tt matcher 2019-04-20 02:19:46 +08:00
bors[bot]
d15abaa06f Merge #1168
1168: Add all remaining mbe matchers r=matklad a=edwin0cheng

This PR adds following  mbe matchers:

* block
* meta
* tt
* literal
* vis

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-04-19 13:54:34 +00:00
Edwin Cheng
1afde29adb Add back missing assert 2019-04-19 21:52:54 +08:00
Edwin Cheng
763569017a Fix bug for ident to lifetime 2019-04-19 21:43:41 +08:00
Edwin Cheng
87ff908135 Add vis matcher 2019-04-19 21:38:26 +08:00
Edwin Cheng
c5983b85fc Add literal matcher 2019-04-19 21:21:47 +08:00
Edwin Cheng
313854c728 Add lifetime matcher 2019-04-19 21:15:19 +08:00
Edwin Cheng
59b6cc780b add tt matcher 2019-04-19 19:41:59 +08:00
Edwin Cheng
762819864f add block matcher 2019-04-19 19:33:29 +08:00
Edwin Cheng
8092b6487f Add block matcher 2019-04-19 18:30:43 +08:00
bors[bot]
153db2467f Merge #1167
1167: Added instructions for Sublime Text 3 setup r=matklad a=OtaK

Hey all!

I'm a Sublime Text 3 user and I wrote instructions to make `rust-analyzer` work with it.

So far works flawlessly, barring the missing features, which is fine (and not the point of this PR).

Great work <3

Thanks,
Mathieu

Co-authored-by: Mathieu Amiot <amiot.mathieu@gmail.com>
2019-04-19 09:55:56 +00:00