This is a quick way to implement unresolved reference diagnostics.
For example, adding to VS Code config
"editor.tokenColorCustomizationsExperimental": {
"unresolvedReference": "#FF0000"
},
will highlight all unresolved refs in red.
3894: Match check enum record r=flodiebold a=JoshMcguigan
This PR implements match statement exhaustiveness checking for record type enums.
It also make a minor addition to the test infrastructure to allow testing against a single diagnostic, so you can be sure your test is triggering (or not) whichever diagnostic you expect.
Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
4029: Fix various proc-macro bugs r=matklad a=edwin0cheng
This PRs does the following things:
1. Fixed#4001 by splitting `LIFETIME` lexer token to two mbe tokens. It is because rustc token stream expects `LIFETIME` as a combination of punct and ident, but RA `tt:TokenTree` treats it as a single `Ident` previously.
2. Fixed#4003, by skipping `proc-macro` for completion. It is because currently we don't have `AstNode` for `proc-macro`. We would need to redesign how to implement `HasSource` for `proc-macro`.
3. Fixed a bug how empty `TokenStream` merging in `proc-macro-srv` such that no L_DOLLAR and R_DOLLAR will be emitted accidentally.
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
4023: Fix another crash from wrong binders r=matklad a=flodiebold
Basically, if we had something like `dyn Trait<T>` (where `T` is a type parameter) in an impl we lowered that to `dyn Trait<^0.0>`, when it should be `dyn Trait<^1.0>` because the `dyn` introduces a new binder. With one type parameter, that's just wrong, with two, it'll lead to crashes.
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Basically, if we had something like `dyn Trait<T>` (where `T` is a type
parameter) in an impl we lowered that to `dyn Trait<^0.0>`, when it should be
`dyn Trait<^1.0>` because the `dyn` introduces a new binder. With one type
parameter, that's just wrong, with two, it'll lead to crashes.
4022: Fix incorrect order of syntax highlight ranges r=ltentrup a=ltentrup
A fix for the bug #4013 which is caused by a difference between tree traversal order and text representation order. In the case of #4013, the attributes of a macro were visited after the macro definition which caused the syntax highlight ranges to be in wrong order. The fix is to sort the ranges before returning.
Co-authored-by: Leander Tentrup <leander.tentrup@gmail.com>
4021: Fix type equality for dyn Trait r=matklad a=flodiebold
Fixes a lot of false type mismatches.
(And as always when touching the unification code, I have to say I'm looking forward to replacing it by Chalk's...)
Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
Fixes a lot of false type mismatches.
(And as always when touching the unification code, I have to say I'm looking
forward to replacing it by Chalk's...)
It's not entirely clear what subnode ranges should mean in the
presence of macros, so let's leave them out for now. We are not using
them heavily anyway.
3996: Fix path for proc-macro in nightly / stable release r=matklad a=edwin0cheng
I messed up that I forget we use different executable names for nightly / stable release, I changed to use the current executable name instead.
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
4008: tests: add more info about what failed in tidy tests r=matklad a=bnjjj
Separate PR from #3954
Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
4007: Reduce allocations when looking up proc macro decl r=edwin0cheng a=lnicola
`libserde_derive` has about 21K symbols on Linux. It's not much, but let's ~~not be wasteful~~ avoid the allocations anyway.
r? @edwin0cheng
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
3958: Add proc-macro related config and tests r=matklad a=edwin0cheng
This PR do the following things:
1. Add cli argument `proc-macro` for running proc-macro server.
2. Added support for proc-macro in bench and analysis-stats
3. Added typescript config for proc-macros
4. Added an heavy test for proc-macros.
To test it out:
1. run `cargo xtask install --proc-macro`
2. add `"rust-analyzer.cargo.loadOutDirsFromCheck": true"` and `"rust-analyzer.procMacro.enabled": true"` in vs code config.
[Edit] Change to use `rust-analyzer proc-macro` for running proc-macro standalone process.
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>