Commit Graph

223 Commits

Author SHA1 Message Date
bors
a6ddf5fb80 Auto merge of #16961 - Wilfred:fix_crate_ids, r=Veykril
Fix crate IDs when multiple workspaces are loaded

Previously, we assumed that the crate numbers in a `rust-project.json` always matched the `CrateId` values in the crate graph. This isn't true when there are multiple workspaces, because the crate graphs are merged and the `CrateId` values in the merged graph are different.

This broke flycheck (see first commit), because we were unable to find the workspace when a file changed, so we every single flycheck, producing duplicate compilation errors.

Instead, use the crate root module path to look up the relevant flycheck. This makes `ProjectWorkspace::Json` consistenet with `ProjectWorkspace::Cargo`.

Also, define a separate JSON crate number type, to prevent bugs like this happening again.
2024-04-01 10:43:06 +00:00
Wilfred Hughes
0f72ab1dd3 Define a separate type for crate indexes in a rust-project.json 2024-03-27 14:18:52 -07:00
Wilfred Hughes
5e370b1cb8 Use crate root to choose relevant workspace for flycheck 2024-03-27 10:33:20 -07:00
Alexis (Poliorcetics) Bourget
174af88e76
feat: Add rust-analyzer.cargo.allTargets to configure passing --all-targets to cargo invocations 2024-03-27 01:57:41 +01:00
Lukas Wirth
8e324e98a1 Rename ProcMacroKind::FuncLike to Bang 2024-03-22 11:20:56 +01:00
Lukas Wirth
ea447062c4 fix: Don't assert paths being utf8 when filtering them in the watcher 2024-03-22 08:04:50 +01:00
Lukas Wirth
2ad14b8069 fix: Fix projects depending on rustc_private hanging 2024-03-21 16:55:42 +01:00
Lukas Wirth
255a8aef92 Move Edition into span crate 2024-03-21 10:21:44 +01:00
Lukas Wirth
c7f02012b1 fix: Fix project discovery not checking whether the Cargo.toml actually exists 2024-03-20 14:39:35 +01:00
Lukas Wirth
399dbc074b internal: Enforce utf8 paths 2024-03-19 15:39:00 +01:00
Lukas Wirth
ba339596bf internal: Delay drawing of workspace dev-dependency edges 2024-03-19 11:37:27 +01:00
Lukas Wirth
76fb73a99e Skip problematic cyclic dev-dependencies 2024-03-18 11:25:59 +01:00
Lukas Wirth
6b48133e9a Prefer cargo proxies when setting RUSTUP_TOOLCHAIN 2024-03-05 10:44:17 +01:00
Lukas Wirth
c310aee8d6 For toolchain binaries ue the full path found in $PATH 2024-03-05 10:17:09 +01:00
Lukas Wirth
4303e741de Cleanup 2024-03-04 11:10:06 +01:00
Lukas Wirth
64c17a9b2e fix: rust-project.json projects not preferring sysroot rustc 2024-02-27 10:20:07 +01:00
Chase Douglas
2826eb51aa Don't build dependencies when retrieving target data layout
`cargo rustc -- <args>` first builds dependencies then calls `rustc <args>` for the current package. Here, we don't want to build dependencies, we just want to call `rustc --print`. An unstable `cargo rustc` `--print` command bypasses building dependencies first. This speeds up execution of this code path and ensures RA doesn't recompile dependencies with the `RUSTC_BOOTSRAP=1` env var flag set.

Note that we must pass `-Z unstable-options` twice, first to enable the `cargo` unstable `--print` flag, then later to enable the unstable `rustc` `target-spec-json` print request.
2024-02-20 19:16:55 -08:00
Chase Douglas
344a79c17d Drop RUSTC_BOOTSTRAP env var when building build scripts
Some packages (e.g. thiserror) force a recompile if the value of the `RUSTC_BOOTSTRAP` env var changes. RA sets the variable to 1 in order to enable rustc / cargo unstable options it uses. This causes flapping recompiles when building outside of RA.

As of Cargo 1.75 the `--keep-going` flag is stable. This change uses the flag without `RUSTC_BOOTSTRAP` if the Cargo version is >= 1.75, and drops `--keep-going` otherwise. This fixes build script recompilation.
2024-02-20 16:42:20 -08:00
Lukas Wirth
d93096ecc0 internal: Fetch toolchain and datalayout for DetachedFiles 2024-02-20 10:40:39 +01:00
Lukas Wirth
ead369117a CrateOrigin::Local means local to the project workspace, not cargo workspace 2024-02-16 16:28:17 +01:00
Lukas Wirth
0ccb3b8731 Move dedup-dev-deps tests into rust-analyzer crate 2024-02-16 15:47:40 +01:00
Lukas Wirth
b1404d387a fix: Split toolchain and datalayout out of CrateData 2024-02-16 14:48:25 +01:00
bors
3bb8d3a32f Auto merge of #16247 - Veykril:opqueues, r=Veykril
fix: Fix build scripts not being rebuilt in some occasions

Also makes proc-macro changed flag setting async, we don't wanna block `process_changes` on the database as that is on the main thread!
2024-02-14 14:33:16 +00:00
Lukas Wirth
1e6cef94df fix: Fix build scripts not being rebuilt in some occasions 2024-02-14 15:20:45 +01:00
Lukas Wirth
465ddef7cc fix: Set RUSTUP_TOOLCHAIN and invoke the proxies instead of directly invoking sysroot binaries 2024-02-14 15:13:45 +01:00
Laurențiu Nicola
c738655188 Set channel override when querying the sysroot metadata 2024-02-14 08:45:11 +02:00
Lukas Wirth
a981db53fa fix: Pass .cargo/config.toml env vars to proc-macro server 2024-02-13 19:42:03 +01:00
Lukas Wirth
a7641a8f57 fix: Fix target layout fetching 2024-02-12 21:29:52 +01:00
Lukas Wirth
8f3209ba27 internal: tool discovery prefers sysroot tools 2024-02-12 12:08:18 +01:00
Tetsuharu Ohzeki
5d1f2835af project-model: Fix warnings about clippy str_to_string rule 2024-02-10 01:00:40 +09:00
Matthias Krüger
ac9d1a03a7 remove clones 2024-02-05 23:15:47 +01:00
Lukas Wirth
9e8a0fae0c Lint debug prints and disallowed types with clippy 2024-02-01 17:57:27 +01:00
Johann Hemmann
e7e09e7750 large_enum_variant 2024-01-31 19:06:35 +01:00
David Barsky
e1ea7c8844 internal: switch to tracing from log
This commit also adds `tracing` to NotificationDispatcher/RequestDispatcher,
bumps `rust-analyzer-salsa` to 0.17.0-pre.6, `always-assert` to 0.2, and
removes the homegrown `hprof` implementation in favor of a vendored
tracing-span-tree.
2024-01-30 12:27:31 -05:00
Lukas Wirth
8a5829cf28 Re-order mod declarations 2024-01-27 11:02:34 +01:00
Johann Hemmann
4858a3784d op_ref 2024-01-19 17:31:01 +01:00
Johann Hemmann
575398134e explicit_auto_deref 2024-01-19 17:31:01 +01:00
Johann Hemmann
28c7fa8dc6 Fix CI 2 2024-01-18 14:18:07 +01:00
Johann Hemmann
fad4fa163c cargo clippy --fix 2024-01-18 13:59:49 +01:00
bors
87e609aa9c Auto merge of #15868 - wasd96040501:fix/symlink2, r=Veykril
fix: failed to infer OUT_DIR when workspace root contains symlink

fix #15867
2024-01-16 09:23:54 +00:00
Lukas Wirth
c7eb52dd7b internal: Add unstable config for loading the sysroot sources via cargo metadata 2024-01-15 09:59:32 +01:00
YangzeLuo
22cda959b3 fix: failed to infer OUT_DIR when workspace root contains symlink 2024-01-12 13:35:53 +08:00
Lukas Wirth
e1c67485bf fix: Differentiate between vfs config load and file changed events 2024-01-09 10:30:16 +01:00
Matthias Krüger
3fb2cd2002 autofix remaining perf findings 2024-01-07 01:20:20 +01:00
Matthias Krüger
476e10e961 remove redundant clones 2024-01-07 00:17:48 +01:00
bors
a2aab001a7 Auto merge of #16241 - Nilstrieb:sysrooting, r=Veykril
Give a userful error when rustc cannot be found in explicit sysroot

Somehow r-a believed that my sysroot was something weird with no rustc. Probably a me issue, but it was impossible to diagnose since r-a just gave me a plain "No such file or directory". Adding this error makes it clear what happened and allows diagnosing the problem.
2024-01-04 14:10:57 +00:00
Nilstrieb
f0f74486bf Give a userful error when rustc cannot be found in explicit sysroot
Somehow r-a believed that my sysroot was something weird with no rustc.
Probably a me issue, but it was impossible to diagnose since r-a just
gave me a plain "No such file or directory". Adding this error makes it
clear what happened and allows diagnosing the problem.
2024-01-03 21:01:06 +01:00
Tetsuharu Ohzeki
efc87092b3 Use Cargo's [workspace.lints.*] to config clippy 2023-12-29 23:51:32 +09:00
bors
7bdf48ce37 Auto merge of #16165 - Veykril:meta-vars, r=Veykril
fix: Update metavariable expression implementation

Fixes https://github.com/rust-lang/rust-analyzer/issues/16154
This duplicates behavior of that before and after PR https://github.com/rust-lang/rust/pull/117050 based on the toolchain version. There are some 1.76 nightlies that are still broken (any before that PR basically) but fetching and storing the commit makes little sense to me (opposed to the toolchain version).
2023-12-20 10:30:58 +00:00
Lukas Wirth
f48ecb6e09 Try to support pre and post-change metavars 2023-12-19 20:45:12 +01:00