3263: Implement unsizing coercions using Chalk r=matklad a=flodiebold
These are coercions like `&[T; n] -> &[T]`, which are handled by the `Unsize` and `CoerceUnsized` traits. The impls for `Unsize` are all built in to the compiler and require special handling, so we need to provide them to Chalk.
This adds the following `Unsize` impls:
- `Unsize<[T]> for [T; _]`
- `Unsize<dyn Trait> for T where T: Trait`
- `Unsize<dyn SuperTrait> for dyn SubTrait`
Hence we are still missing the 'unsizing the last field of a generic struct' case.
Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
3260: Refactor how builtins are resolved r=matklad a=flodiebold
This fixes autocompletion suggesting e.g. `self::usize`. (I thought we had a bug for that, but I didn't find it.)
Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
3262: Fix handling of const patterns r=matklad a=flodiebold
E.g. in `match x { None => ... }`, `None` is a path pattern (resolving to the
option variant), not a binding. To determine this, we need to try to resolve the
name during lowering. This isn't too hard since we already need to resolve names
for macro expansion anyway (though maybe a bit hacky).
Fixes#1618.
Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
3244: Rename module references r=matklad a=adamrk
Rename references to a module when the module is renamed. This fixes some missing renames in the existing implementation. For example, renaming the module `foo` to `foo2` in this case:
```rust
mod foo {
pub fn bar() {}
}
fn main() {
foo::bar()
}
```
previously would not change the call `foo::bar()` to `foo2::bar()`, but now it will.
Co-authored-by: adamrk <ark.email@gmail.com>
Co-authored-by: Adam Bratschi-Kaye <ark.email@gmail.com>
3264: Tidy up documentation. r=flodiebold a=ablakey
Thought I'd tidy up the docs while reading through them. Hope you don't mind!
For the most part, I just made the formatting consistent through-out and added a few words here and there. Also updated the language server install graphic.
Co-authored-by: Andrew Blakey <ablakey@locusrobotics.com>
E.g. in `match x { None => ... }`, `None` is a path pattern (resolving to the
option variant), not a binding. To determine this, we need to try to resolve the
name during lowering. This isn't too hard since we already need to resolve names
for macro expansion anyway (though maybe a bit hacky).
Fixes#1618.
3247: Improve RA version display r=matklad a=edwin0cheng
There are 2 problems of current implementation for displaying current version of RA binary:
1. If that binary is coming from built by source, the `REV` may not be updated somehow. (See discussion in [Zuilp](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/vscode.20version.20in.20console))
2. We must go through the VSCode debugger console to see the output of `console.log`.
This PR implemented a new VSCode command "Show RA Version" to display the version, which fixed the first problem. And added some `rerun-if` flags in `build.rs` to fix the second one.
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
3252: Improve integration with token color configuration r=matklad a=eaglgenes101
First, the extension now checks theme token color customizations as well as global token color customizations when determining what colors to highlight syntax with. Theme token color customizations take precedence over both global token color customizations and the theme token colors.
Second, a few additional token color customization keys used by other themes are added. The original paths still take precedence, but now turning on rust analyzer syntax highlighting should now not unexpectedly homogenize token colors when custom themes are used.
Co-authored-by: eaglgenes101 <eaglgenes101@gmail.com>