Commit Graph

25681 Commits

Author SHA1 Message Date
Lukas Wirth
5c466ccc2b Refactor out some crate wide data in DefMap into nested struct 2023-06-01 15:04:38 +02:00
Lukas Wirth
dc7c6d43c7 Slightly shrink DefMap 2023-06-01 14:46:36 +02:00
bors
117f9b7752 Auto merge of #14939 - Veykril:nav-focus-ranges, r=Veykril
fix: Fix nav target calculation discarding file ids from differing macro upmapping

Fixes https://github.com/rust-lang/rust-analyzer/issues/14792

Turns out there was the assumption that upmapping from a macro will always end in the same root file, which is no longer the case thanks to `include!`
2023-06-01 09:19:24 +00:00
Lukas Wirth
a7d604d46f fix: Fix nav target calculation discarding file ids from differing macro upmapping 2023-06-01 11:05:03 +02:00
bors
7f2ac29e28 Auto merge of #14938 - Veykril:sig-help, r=Veykril
Add signature help for tuple patterns and expressions

~~These are somewhat wonky since their signature changes as you type depending on context but they help out nevertheless.~~ should be less wonky now with added parser and lowering recoveries
2023-06-01 07:07:23 +00:00
Lukas Wirth
0e28202832 Insert missing expr/pat for leading comma tuples 2023-06-01 08:56:40 +02:00
Lukas Wirth
7d1bf7023d Recover from leading comma in tuple pat and expr 2023-06-01 08:40:50 +02:00
Lukas Wirth
42450d2511 Add signature help for tuple patterns and expressions 2023-06-01 07:45:55 +02:00
bors
bafa6c4ee5 Auto merge of #14935 - Veykril:sysroot-dedup, r=Veykril
fix: Don't duplicate sysroot crates in rustc workspace

Since we handle `library` as the sysroot source directly in the rustc workspace, we now duplicate the crates there, once as sysroot and once as just plain workspace crate. This causes a variety of issues for `vec!` macros and similar that emit `$crate` tokens across crates.
2023-05-31 13:50:53 +00:00
Lukas Wirth
ecb8616870 fix: Don't duplicate sysroot crates in rustc workspace 2023-05-31 15:37:35 +02:00
Oli Scherer
1570299af4 Remove const eval limit and implement an exponential backoff lint instead 2023-05-31 10:24:17 +00:00
bors
526507fe22 Auto merge of #14888 - lunacookies:multi-qos, r=Veykril
Prioritize threads affected by user typing

To this end I’ve introduced a new custom thread pool type which can spawn threads using each QoS class. This way we can run latency-sensitive requests under one QoS class and everything else under another QoS class. The implementation is very similar to that of the `threadpool` crate (which is currently used by rust-analyzer) but with unused functionality stripped out.

I’ll have to rebase on master once #14859 is merged but I think everything else is alright :D
2023-05-31 10:23:19 +00:00
bors
d2b3caa5b5 Auto merge of #14929 - Veykril:hover-hex, r=Veykril
Add render configs for memory layout hovers

Closes https://github.com/rust-lang/rust-analyzer/issues/14918
2023-05-30 16:47:41 +00:00
Lukas Wirth
3c862507b9 Add render configs for memory layout hovers 2023-05-30 18:36:06 +02:00
bors
e33c0b4b5e Auto merge of #14842 - alibektas:internal/ast-make-improve, r=Veykril
Improve ast::make

Add `ty_alias` and make `impl_trait` , `fn` and `impl_` have more coverage.
2023-05-30 16:09:46 +00:00
bors
76d86502f7 Auto merge of #14912 - Veykril:cargo-alltargets, r=Veykril
Don't add --all-targets to runnables for no-std crates

Fixes https://github.com/rust-lang/rust-analyzer/issues/14155
2023-05-30 12:34:28 +00:00
bors
be446c6fd7 Auto merge of #14905 - Veykril:hover-hex, r=Veykril
feat: Render niches on hover
2023-05-30 12:19:51 +00:00
bors
e8dbb8e2e0 Auto merge of #14911 - Veykril:config-cfg, r=Veykril
Allow setting cfgs

Fixes https://github.com/rust-lang/rust-analyzer/issues/14365
2023-05-30 12:00:14 +00:00
Lukas Wirth
1275adc200 Don't leak rustc Layout in hir layer 2023-05-30 13:54:30 +02:00
Lukas Wirth
3514f2f2ab Render niches on hover 2023-05-30 13:49:43 +02:00
bors
51c3ab5b85 Auto merge of #14920 - lowr:fix/overhaul-named-struct-to-tuple-struct, r=Veykril
Fix edits for `convert_named_struct_to_tuple_struct`

Two fixes:
- When replacing syntax nodes, macro files weren't taken into account. Edits were simply made for `node.syntax().text_range()`, which would be wrong range when `node` is inside a macro file.
- We do ancestor node traversal for every struct name reference to find record expressions/patterns to edit, but we didn't verify that expressions/patterns do actually refer to the struct we're operating on.

Best reviewed one commit at a time.

Fixes #13780
Fixes #14927
2023-05-30 11:45:22 +00:00
bors
bc8295255c Auto merge of #14892 - HKalbasi:mir, r=HKalbasi
MIR episode 6

This PR separates monomorphization from interpreting, and add a monomorphization query to cache the results. Together with making layout queries returning `Arc<Layout>` instead of `Layout` (did you know that `Layout` is a 312 byte struct with a couple of vectors, so it is very costly to clone? I thought it should be very small and cheap) it makes mir interpreting an order of magnitude faster in warmed calls.

It still can't evaluate no test in the r-a repo, but all tests that I tried are hitting #7434 so I hope after that it will become able to interpret some real world test.
2023-05-29 16:40:11 +00:00
David Lattimore
67f1c3cd16 autopublish: Offset version number
The workflow is currently failing because it's trying to publish 0.0.16,
while the last version published was 0.0.149.
2023-05-29 21:24:20 +10:00
Ryo Yoshida
033e6ac57a
Verify name references more rigidly
Previously we didn't verify that record expressions/patterns that were
found did actually point to the struct we're operating on. Moreover,
when that record expressions/patterns had missing child nodes, we would
continue traversing their ancestor nodes.
2023-05-29 20:10:54 +09:00
Ryo Yoshida
ab9347542c
Consider macro files when replacing nodes 2023-05-29 19:52:31 +09:00
hkalbasi
51368793b4 MIR episode 6 2023-05-28 23:25:15 +03:30
bors
505fd09f9e Auto merge of #14916 - Veykril:typed-hole, r=Veykril
feat: Add diagnostic for `_` expressions (typed holes)
2023-05-28 13:26:51 +00:00
Lukas Wirth
8bc826dd53 Add diagnostic for _ expressions (typed holes) 2023-05-28 14:55:28 +02:00
Lukas Wirth
bbd9e41606 Don't add --all-targets to runnables for no-std crates 2023-05-28 14:18:44 +02:00
Luna Razzaghipour
6b46095980
Make formatting a latency-sensitive request 2023-05-28 22:10:24 +10:00
bors
150082b0e3 Auto merge of #14878 - lowr:feat/metavar-expr-count, r=Veykril
Implement `${count()}` metavariable expression

This PR implements `${count()}` metavariable expression for MBE as described in [RFC 3086][rfc]. See [this section][sec-count] of the RFC for its semantics.

Additionally, this PR changes the type of depth parameter of `${index()}` from u32 to usize so as to match how [rustc parses it][index-usize].

Part of #11952
Fixes #14871

[rfc]: https://github.com/rust-lang/rfcs/pull/3086
[sec-count]: https://github.com/rust-lang/rfcs/blob/master/text/3086-macro-metavar-expr.md#count
[index-usize]:ddad0576ca/compiler/rustc_expand/src/mbe/metavar_expr.rs (L22)
2023-05-28 11:45:42 +00:00
Lukas Wirth
cea84427e0 Allow setting cfgs 2023-05-28 13:43:21 +02:00
Ryo Yoshida
0d4d1d7e3b
Implement ${count()} metavariable expression 2023-05-28 19:54:36 +09:00
Ryo Yoshida
9ebaa85d37
Split test module for metavariable expressions 2023-05-28 19:54:23 +09:00
Luna Razzaghipour
74bc2a47e0
Wrap platform-specific QoS in r-a-specific “thread intent” 2023-05-28 20:37:38 +10:00
Luna Razzaghipour
d0b001eed2
Use appropriate QoS classes throughout the codebase 2023-05-28 20:37:37 +10: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
bors
f6e3a87bf9 Auto merge of #14914 - mashuler:fix-rustup-installation-description, r=lnicola
Fix rustup installation description

While going through the process of installing rust-analyzer to use with Neovim, I noticed that the instructions for installing with rustup are incorrect now that [issue #2411](https://github.com/rust-lang/rustup/issues/2411) has been closed. Now when rust-analyzer is installed using rustup, it is installed in ~/.cargo/bin and a symlink or some other workaround is no longer needed. I have updated the documentation accordingly.
2023-05-27 08:46:10 +00:00
bors
1b5523a8cd Auto merge of #14913 - HKalbasi:fix14844, r=HKalbasi
Evaluate `UnevalutedConst` before trait solving

cc #14844
2023-05-26 21:01:20 +00:00
hkalbasi
cd4bffdd69 Evaluate UnevalutedConst before trait solving 2023-05-27 00:28:11 +03:30
Mason Shuler
05d63eff9c Make rustup heading title match other titles 2023-05-26 16:41:51 -04:00
Mason Shuler
def3b5d7dd Remove outdated rustup installation issue description 2023-05-26 16:40:30 -04:00
bors
7c81fff520 Auto merge of #14910 - Veykril:cargo-features, r=Veykril
Filter out unused cargo features from config

Closes https://github.com/rust-lang/rust-analyzer/issues/11836
2023-05-26 20:17:24 +00:00
Lukas Wirth
35b208aaa7 Filter out unused cargo features from config 2023-05-26 22:16:34 +02:00
bors
9e6ae6bac7 Auto merge of #14909 - Veykril:ci-proc-macros, r=Veykril
Run CI on nightly rust when proc-macro-* crates change
2023-05-26 19:07:09 +00:00
Lukas Wirth
ee8c18cb6e Fix out_dirs_check test on stable 2023-05-26 20:54:58 +02:00
Lukas Wirth
934df697e3 Add the toolchain channel as a caching key for CI 2023-05-26 20:30:54 +02:00
Lukas Wirth
28442403a4 Run CI on nightly rust when proc-macro-* crates change 2023-05-26 20:24:28 +02:00
jyn
aa65395c49 Update proc-macro-api for the new rustc metadata format 2023-05-26 11:59:25 -05:00
bors
08f0c29954 Auto merge of #14906 - davidbarsky:davidbarsky/add-option-to-disable-explorer, r=Veykril
fix: add a toggle to disable the dependency explorer

For common uses of non-Cargo build systems with rust-analyzer, the dependency view isn't particularly helpful because there isn't a Cargo.toml present for dependencies or the dependencies are part of the current workspace.

Speaking from the perspective of a user of `rust-project.json`, I'd prefer to have this feature disabled until I can add a field to `Crate` that defines the location of a build file (e.g., a `BUCK`) file, which would allow for removing the "search for a Cargo.toml in parent directories of a crate root" behavior that exists in a few places (I've opened [an issue](https://github.com/rust-lang/cargo/issues/12187) on Cargo to request this data from `cargo-metadata`).
2023-05-26 16:49:13 +00:00