9614: Parse input expressions for dbg! invocations in remove_dbg r=Veykril a=Veykril
Instead of inspecting the input tokentree manually, parse the input as `,` delimited expressions instead and act on that. This simplifies the assist quite a bit.
Fixes#8455
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
9611: minor: Explicitly connect an ambiguous import path case logic with its test r=SomeoneToIgnore a=SomeoneToIgnore
Follows up https://github.com/rust-analyzer/rust-analyzer/pull/8820/
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
9600: fix: Single-line and nested blocks in the `unwrap_block` assist r=Veykril a=patrick-gu
Fixes#8411
Rework the system for stripping whitespace and braces in the unwrap_block assist to allow correct unwrapping of blocks such as:
```rust
{ $0 0 }
```
into
```rust
0
```
and nested blocks, such as:
```rust
$0{
{
3
}
}
```
into
```rust
{
3
}
```
This is done by creating the `update_expr_string_with_pat` function (along with `update_expr_string` and `update_expr_string_without_newline`), which strips whitespace and braces in a way that ensures that only whitespace and a maximum of one brace are removed from the start and end of the expression string.
I have also created several tests to ensure that this functionality works correctly.
Co-authored-by: patrick-gu <55641350+patrick-gu@users.noreply.github.com>
9592: internal: Split main highlighting function up into a few subfunctions r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
9550: Proc macro multi abi proof of concept r=matklad a=alexjg
#8925 was irritating me so I thought I would have a bash at fixing it. What I've done here is copy the `crates/proc_macro_srv/src/proc_macro` code (which is copied from `<RUST>/library/proc_macro`) to `crates/proc_macro_srv/src/proc_macro_nightly` and the modified the nightly version to include the changes from https://github.com/rust-analyzer/rust-analyzer/pull/9047 and aeb7b183a2
This gives us the code to support both stable and nightly ABIs. Then we use the `proc_macro_api::version::read_dylib_info` to determine which version of the ABI to load when creating a `ProcMacroLibraryLibLoading` (which is now an enum).
This seems to work for me. The code could be cleaned up but I wanted to see if the approach makes sense before I spend more time on it.
I've split the change into two commits, the first is just copying and modifying the `proc_macro` crate, the second contains most of the interesting work around figuring out which ABI to use.
Co-authored-by: Alex Good <alex@memoryandthought.me>
Co-authored-by: alexjg <alex@memoryandthought.me>
9583: internal: get rid of a call to slow O(N) visibility_of function r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
In rust-analyzer, we avoid defualt impls for types which don't have
sensible, "empty" defaults. In particular, we avoid using invalid
indices for defaults and similar hacks.
Rather than a "Stable" and "Nightly" ABI we instead name ABIs based on
the version of the rust compiler in which they were introduced. We place
these ABIs in a new module - `proc_macro_srv::abis` - where we also add
some mchinery to abstract over ABIs. This should make it easy to add new
ABIs at a later date as the rust compiler evolves.
9579: fix: Set more `CARGO_` env vars r=jonas-schievink a=jonas-schievink
Set `CARGO_CRATE_NAME` to the package name, with `-` replaced by `_`. This is wrong, but better than not setting the variable at all.
Also set `CARGO_PKG_HOMEPAGE` since it's easy.
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>