Commit graph

1483 commits

Author SHA1 Message Date
bors
e91fdf7860 Auto merge of #15959 - Veykril:macro-shower3, r=lnicola
TokenMap -> SpanMap rewrite

Opening early so I can have an overview over the full diff more easily, still very unfinished and lots of work to be done.

The gist of what this PR does is move away from assigning IDs to tokens in arguments and expansions and instead gives the subtrees the text ranges they are sourced from (made relative to some item for incrementality). This means we now only have a single map per expension, opposed to map for expansion and arguments.

A few of the things that are not done yet (in arbitrary order):
- [x] generally clean up the current mess
- [x] proc-macros, have been completely ignored so far
- [x] syntax fixups, has been commented out for the time being needs to be rewritten on top of some marker SyntaxContextId
- [x] macro invocation syntax contexts are not properly passed around yet, so $crate hygiene does not work in all cases (but most)
  - [x] builtin macros do not set spans properly, $crate basically does not work with them rn (which we use)
~~- [ ] remove all uses of dummy spans (or if that does not work, change the dummy entries for dummy spans so that tests will not silently pass due to havin a file id for the dummy file)~~
  - [x] de-queryfy `macro_expand`, the sole caller of it is `parse_macro_expansion`, and both of these are lru-cached with the same limit so having it be a query is pointless
- [x] docs and more docs
- [x] fix eager macro spans and other stuff
  - [x] simplify include! handling
- [x] Figure out how to undo the sudden `()` expression wrapping in expansions / alternatively prioritize getting invisible delimiters working again
- [x] Simplify InFile stuff and HirFIleId extensions
~~- [ ] span crate containing all the file ids, span stuff, ast ids. Then remove the dependency injection generics from tt and mbe~~

Fixes https://github.com/rust-lang/rust-analyzer/issues/10300
Fixes https://github.com/rust-lang/rust-analyzer/issues/15685
2023-12-04 19:59:53 +00:00
Lukas Wirth
b98597f06d Re-enable proc-macros 2023-11-28 16:28:56 +01:00
David Barsky
914a1570e2 internal: bump triomphe to 0.1.10 2023-11-28 10:27:17 -05:00
Lukas Wirth
98cfdde8ba Thinner TokenMap 2023-11-28 10:56:25 +01:00
Lukas Wirth
30093a6d81 spans always come from real file 2023-11-28 10:55:39 +01:00
Lukas Wirth
890eb17b4e Replace ID based TokenMap with proper relative text-ranges / spans 2023-11-28 10:55:39 +01:00
Laurențiu Nicola
3ccde009cb Switch to our own salsa fork 2023-11-26 13:06:36 +02:00
Laurențiu Nicola
fc880be491 Bump chalk 2023-11-25 20:38:11 +02:00
Laurențiu Nicola
aadeb66d03 Bump ra-ap-rustc_index and ra-ap-rustc_abi 2023-11-25 20:36:45 +02:00
Laurențiu Nicola
c01679eb7b Bump ra-ap-rustc_lexer 2023-11-25 20:36:06 +02:00
Laurențiu Nicola
fa74ac8457 Bump ra-ap-rustc_parse_format 2023-11-25 20:35:26 +02:00
Marc Schreiber
81c2d3552e Cancelable Initialization
This commit provides additional initialization methods to Connection in
order to support CTRL + C sigterm handling.
2023-11-21 21:29:33 +01:00
Laurențiu Nicola
480cb60be3 Bump libc 2023-11-16 21:48:49 +02:00
Laurențiu Nicola
da24b6fb12 Bump memchr 2023-11-15 21:24:20 +02:00
Laurențiu Nicola
8ea06c8ec8 Bump arbitrary and derive-arbitrary 2023-11-15 21:22:34 +02:00
Laurențiu Nicola
c6fad55c98 Bump bitflags 2023-11-15 21:20:47 +02:00
Laurențiu Nicola
3ed27d21f2 Bump cargo_metadata 2023-11-15 21:18:49 +02:00
Laurențiu Nicola
2814d646cb Bump rayon 2023-11-15 21:14:56 +02:00
Laurențiu Nicola
b18ce4f8ea Bump xshell 2023-11-15 21:12:18 +02:00
Laurențiu Nicola
83e6d7938c Bump tracing-tree again 2023-11-15 21:08:35 +02:00
Laurențiu Nicola
c66084b9c6 Bump ra-ap-rustc_index and ra-ap-rustc_abi 2023-11-15 13:42:13 +02:00
Laurențiu Nicola
b267f6b071 Bump ra-ap-rustc_lexer 2023-11-15 13:40:43 +02:00
Laurențiu Nicola
829cf8db4c Bump dissimilar 2023-11-15 13:34:56 +02:00
Laurențiu Nicola
572583262c Bump text-size 2023-11-15 13:33:03 +02:00
Laurențiu Nicola
a1f81a7e75 Bump chalk 2023-11-15 13:31:45 +02:00
Laurențiu Nicola
c4dfa06b9d Bump tracing-log 2023-11-15 13:25:19 +02:00
Laurențiu Nicola
1fc056ec93 Bump indexmap 2023-11-15 13:21:34 +02:00
Laurențiu Nicola
2bfd6b659d Bump serde_json 2023-11-15 13:17:36 +02:00
Laurențiu Nicola
970a796368 Bump serde 2023-11-15 13:16:07 +02:00
Laurențiu Nicola
cb8434e594 Bump either 2023-11-15 13:07:36 +02:00
Laurențiu Nicola
2dbdaa247b Bump tracing-subscriber 2023-11-15 13:04:39 +02:00
Laurențiu Nicola
d83620a5ba Bump tracing-tree 2023-11-15 13:01:54 +02:00
Laurențiu Nicola
f53368dd3f Bump tracing 2023-11-15 13:00:32 +02:00
Laurențiu Nicola
f66df10f87 Bump itertools 2023-11-15 12:53:56 +02:00
Laurențiu Nicola
dfc885e0fd Bump anyhow 2023-11-15 12:49:32 +02:00
hkalbasi
1086b294c2 update rustc dependencies 2023-11-08 01:16:47 +03:30
Roberto Bampi
99ec3aa8a3 scip: update crate to version 0.3.1.
While the git repo has been updated constantly, crates.io has only now
been updated after more than a year of activity.
2023-10-26 16:20:06 +02:00
Lukas Wirth
40acc5250f Update rustc_abi dependency 2023-10-15 18:57:40 +02:00
bors
aaa1e8e1b8 Auto merge of #15618 - shogo-nakano-desu:internal/port-anymap, r=Veykril
internal: port anymap

## Description
- The anymap crate has been ported. During this process, unnecessary features for rust-analyzer have been removed.
- From the tests that were checking the existing licenses, the anymap license (`BlueOak-1.0.0 OR MIT OR Apache-2.0`) has been removed.

## Requests
- While porting the code this time, I have tried to respect the original author's intentions and have kept the comments/codes as much as possible. Please don't hesitate to tell me if you think the comments/codes also need to be appropriately modified.
- If there are any necessary changes regarding the licensing or anything else, please let me know so I can fix them.

## Issue
https://github.com/rust-lang/rust-analyzer/issues/15500
2023-10-09 08:40:54 +00:00
Henry Chen
963ba59579 minor: update libc to 0.2.148
`cargo update -p libc`
2023-09-25 10:13:25 +08:00
shogo-nakano-desu
6212182739 refactor: remove hashbrown deps since we can use std 2023-09-20 09:02:10 +09:00
shogo-nakano-desu
f671b0b864 refactor: move implementation inside anymap crate into stdx crate 2023-09-20 09:02:10 +09:00
shogo-nakano-desu
4b3257a365 refactor: port anymap 2023-09-20 09:02:05 +09:00
Wilfred Hughes
3a63255d2a Update chalk version 2023-09-19 16:56:59 -07:00
hkalbasi
f4704bc8ae Switch to in-tree rustc dependencies with a cfg flag 2023-09-15 18:10:11 +03:30
Lukas Wirth
10b0cd7047 Replace format-args parser with upstream fork 2023-09-07 11:37:59 +02:00
bors
f29867bd26 Auto merge of #15559 - Veykril:builtin-format-args, r=Veykril
Implement builtin#format_args, using rustc's format_args parser

`format_args!` now expands to `builtin#format_args(template, args...)`, the actual expansion now instead happens in lowering where we desugar this expression by using lang paths.

As a bonus, we no longer need to evaluate `format_args` as an eager macro which means less macro expansions overall -> less cache thrashing!

Fixes https://github.com/rust-lang/rust-analyzer/issues/15082
2023-09-06 17:44:33 +00:00
Lukas Wirth
abe8f1ece4 Implement builtin#format_args, using rustc's format_args parser 2023-09-05 19:19:46 +02:00
Roberto Bampi
4f22e1a187 Update notify to 6.1.1
Unlike version 6.0.1, this does not pull windows-sys 0.4.5 as observed in #15077.

$ cargo tree --target=x86_64-pc-windows-gnu --charset=ascii | grep windows-sys

|           |   `-- windows-sys v0.42.0
|   |   |   |   |   |       `-- windows-sys v0.42.0 (*)
|       `-- windows-sys v0.48.0
    |   |   `-- windows-sys v0.48.0 (*)
    |   `-- windows-sys v0.48.0 (*)
|   `-- windows-sys v0.48.0 (*)
|   `-- windows-sys v0.42.0 (*)
2023-09-04 18:00:12 +02:00
Lukas Wirth
c09f175d59 Less once_cell more std 2023-09-01 17:30:59 +02:00
Alex Kladov
43e868807e internal: up lsp-server 2023-08-22 11:42:53 +01:00
bors
9b82437de1 Auto merge of #15495 - matklad:matklad/unpin, r=lnicola
internal: unpin serde

Serde no longer uses blobs as of

https://github.com/serde-rs/serde/pull/2590

As such, there's no longer need for us to pin it.

Note that this doesn't upgrade serde version we use: I am fairly confident that the blobs are already there are fine, and now I am fairly confident that all future versions of serde will be fine as well.
2023-08-22 10:20:31 +00:00
Alex Kladov
343ee8bacf internal: unpin serde
Sered no longer uses blobs as of

https://github.com/serde-rs/serde/pull/2590

As such, there's no longer need for us to pin it.

Note that this doesn't upgrade serde version we use: I am fairly
confident that the blobs are already there are fine, and now I am fairly
confident that all future versions of serde will be fine as well.
2023-08-21 14:29:18 +01:00
Laurențiu Nicola
30d8aa1bec Merge commit '9b3d03408c66749d56466bb09baf2a7177deb6ce' into sync-from-ra 2023-08-21 12:44:09 +03:00
Alex Kladov
1cebc0ca13 internal: post-bump lsp-server version 2023-08-19 15:28:32 +01:00
Alex Kladov
6c46b98a95 fix: avoid problematic serde release
serde 1.0.172 and up rely on opaque non-reproducible binary blobs to
function, explicitly not providing a library-level opt-out.

This is problematic for two reasons:

- directly, unauditable binary blobs are a security issue.
- indirectly, it becomes much harder to predict future behaviors of the
  crate.

As such, I am willing to go on a limb here and forbid building
rust-analyzer with those versions of serde. Normally, my philosophy is
to defer the choice to the end user, but it's also a design constraint
of rust-analyzer that we don't run random binaries downloaded from the
internet without explicit user's concent.

Concretely, this upper-bounds serde for both rust-analyzer workspace, as
well as the lsp-server lib.

See https://github.com/serde-rs/serde/issues/2538 for wider context.
2023-08-19 14:14:23 +01:00
Alex Kladov
dadbfe7f4b upgrade lsp server 2023-08-19 13:36:07 +01:00
dirreke
4ddc6a780e update Cargo.lock 2023-08-15 01:27:26 +08:00
Laurențiu Nicola
4704881b64 Merge commit '37f84c101bca43b11027f30ab0c2852f9325bc3d' into sync-from-ra 2023-07-17 16:49:15 +03:00
hkalbasi
59420afa46 Support getrandom syscall 2023-07-11 00:29:06 +03:30
bors
45272efec5 Auto merge of #14990 - HKalbasi:diagnostic-map, r=HKalbasi
Map our diagnostics to rustc and clippy's ones

And control their severity by lint attributes `#[allow]`, `#[deny]` and ... .

It doesn't work with proc macros and I would like to fix that before merge but I don't know how to do it.
2023-07-03 18:58:47 +00:00
bors
b9101895d2 Auto merge of #15205 - Veykril:load-cargo, r=Veykril
Split out project loading capabilities from rust-analyzer crate

External tools currently depend on the entire lsp infra for no good reason so let's lift that out so those tools have something better to depend on
2023-07-03 15:46:09 +00:00
Lukas Wirth
28fcd1bdd7 Split out project loading capabilities from rust-analyzer crate 2023-07-03 17:40:31 +02:00
bors
2d83bc5bce Auto merge of #15149 - Veykril:line-index-perf, r=Veykril
internal: Speedup line index calculation via SSE2
2023-07-03 15:11:51 +00:00
Lukas Wirth
97748b0fc6 Speedup line index calculation via SSE2 2023-07-03 16:46:28 +02:00
hkalbasi
bb85a980e0 Bump chalk 2023-06-30 23:36:47 +03:30
Josh Stone
380773b3e8 Upgrade to indexmap v2 2023-06-24 17:35:20 -07:00
Lukas Wirth
e5c65071bc Disconnect library crate dependencies from workspace dependencies 2023-06-22 11:50:52 +02:00
Lukas Wirth
0953e85b59 Downgrade some deps to get rif of windows-sys duplication 2023-06-22 11:44:10 +02:00
Lukas Wirth
8823db6c78 Bump more deps 2023-06-22 11:44:10 +02:00
Lukas Wirth
4fa3f1ef5c Bump serde 2 things 2023-06-22 11:44:10 +02:00
David Lattimore
5c8d1a46b5 Use lib crates from crates.io
See lib/README.md for justification
2023-06-21 16:10:17 +10:00
David Tolnay
f57997ef6a Delete use of proc_macro_span_shrink from proc-macro2 2023-06-20 19:53:06 -04:00
David Lattimore
fb3e54ef05 Release lsp-server 0.7.1 2023-06-20 13:53:39 +10:00
David Lattimore
a0467c546c Release la-arena 0.3.1 2023-06-20 13:53:39 +10:00
Laurențiu Nicola
9326cf7f0c Merge commit 'cd3bf9fe51676b520c546460e6d8919b8c8ff99f' into sync-from-ra 2023-06-19 09:14:04 +03:00
Alex Kladov
424ef77809 internal: remove spurious regex dependency
- replace tokio's env-filter with a smaller&simpler targets filter
- reshuffle logging infra a bit to make sure there's only a single place
  where we read environmental variables
- use anyhow::Result in rust-analyzer binary
2023-06-18 13:59:32 +01:00
hkalbasi
527dfede48 Support Pointee trait 2023-06-16 16:43:43 +03:30
hkalbasi
e55a1f1916 Map our diagnostics to rustc and clippy's ones 2023-06-15 01:47:22 +03:30
Laurențiu Nicola
08ef169435 Fix dependency warning 2023-06-07 12:34:38 +03:00
Laurențiu Nicola
bbd695589e Merge commit 'ed87e0a20a9d196a5ea659ea46ae9574be666d4f' into sync-from-ra 2023-06-05 15:10:05 +03:00
Laurențiu Nicola
768a6c5931 Add back sysroot-abi feature gate to rust-analyzer 2023-06-05 14:43:31 +03:00
Laurențiu Nicola
c48062fe2a Merge commit 'aa9bc8612514d216f84eec218dfd19ab83f3598a' into sync-from-ra 2023-06-05 12:04:23 +03:00
Luna Razzaghipour
2924fd2213
Implement custom QoS-aware thread pool
This code replaces the thread pool implementation we were using
previously (from the `threadpool` crate). By making the thread pool
aware of QoS, each job spawned on the thread pool can have a different
QoS class.

This commit also replaces every QoS class used previously with Default
as a temporary measure so that each usage can be chosen deliberately.
2023-05-28 20:37:35 +10:00
Lukas Wirth
35b208aaa7 Filter out unused cargo features from config 2023-05-26 22:16:34 +02:00
Luna Razzaghipour
ca6461c143
Add proof-of-concept QoS implementation 2023-05-20 22:29:32 +10:00
Lukas Wirth
099b5b3b15 internal: Bump rustc_lexer 2023-05-18 10:17:40 +02:00
Ariel Davis
594a41e7bf Use pre.1, tweak comment 2023-05-06 00:51:25 -07:00
Ariel Davis
4a1922fd1a Depend on nohash-hasher individually 2023-05-06 00:49:23 -07:00
Ariel Davis
85dd7b22b4 Use nohash_hasher, rm comment 2023-05-06 00:49:23 -07:00
Ariel Davis
7e1992a0d9 Make line-index an external lib 2023-05-06 00:49:23 -07:00
Ariel Davis
29256f22e4 Make non-hash an external lib 2023-05-06 00:49:23 -07:00
Laurențiu Nicola
7197a27028 Use triomphe Arc 2023-05-02 20:02:43 +03:00
Lukas Wirth
c21860bd6a Remove proc-macro server command from the rust-analyzer binary 2023-04-26 08:19:28 +02:00
Lukas Wirth
10d7d7304b
Revert "Handle dev-dependency cycles" 2023-04-25 14:29:26 +02:00
Lukas Wirth
e205af259d Prefer test duped crates for ide features 2023-04-25 11:39:58 +02:00
Laurențiu Nicola
160ab88bb9 Bump bitflags 2023-04-17 18:42:59 +03:00
Laurențiu Nicola
840cfd0862 Bump mimalloc 2023-04-17 17:38:47 +03:00
Laurențiu Nicola
8e192b0298 Bump cargo_metadata 2023-04-17 17:26:55 +03:00
Laurențiu Nicola
1737bd628f Bump proc-macro2 2023-04-17 17:23:09 +03:00