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>
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>
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>
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>
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>
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>
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>
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>