Commit graph

327 commits

Author SHA1 Message Date
Nicholas Rishel
1f9686993a Add config setting which allows adding additional include paths to the VFS. 2025-01-08 10:57:46 -08:00
Lukas Wirth
619af1871b
Merge pull request #18867 from Veykril/push-ntmxlropxkrr
internal: target-triple -> target-tuple + version fetching cleanup
2025-01-07 13:46:58 +00:00
Lukas Wirth
59c8e27acc Add some smoke tests to toolchain_info 2025-01-07 14:33:24 +01:00
Lukas Wirth
b8a0488740 Align toolchain version fetching with other toolchain info querying
Fix --target flag argument order in rustc_cfg fetching
2025-01-07 14:30:46 +01:00
Lukas Wirth
2ac803ec71 target-triple -> target-tuple 2025-01-07 14:25:43 +01:00
Lukas Wirth
86d35a55a6
Merge pull request #18788 from Veykril/push-zxystwnotuvq
Remove `rust-analyzer.cargo.sysrootQueryMetadata` config again
2025-01-07 13:14:29 +00:00
Lukas Wirth
f1c0d176f3 Remove rust-analyzer.cargo.sysrootQueryMetadata config again 2025-01-07 14:00:22 +01:00
Bogdan Mircea
4382331a36 project-model: fix JSON project PackageRoot buildfile inclusion 2025-01-07 13:47:17 +02:00
Lukas Wirth
72b9427162
Merge pull request #18846 from Veykril/push-kmspklwynynu
minor: New clippy lints
2025-01-06 17:12:14 +00:00
Lukas Wirth
4b6007115a minor: New clippy lints 2025-01-06 17:57:17 +01:00
Lukas Wirth
cf2bfd427a fix: Fix relative .cargo env vars not working 2025-01-06 08:50:41 +01:00
lucasholten
cdc972499e Automatically sort crate graph 2025-01-02 15:50:51 +01:00
lucasholten
86441c5bb9 Fix tests 2025-01-01 16:42:29 +01:00
lucasholten
e12fe30351 Remove load_cargo_with_fake_sysroot 2025-01-01 16:24:21 +01:00
lucasholten
e15df1f414 Add back tests removed in #18080 2024-12-31 15:48:58 +01:00
lucasholten
c46e9c48b0 Remove CARGO_RUSTC_CURRENT_DIR 2024-12-31 15:47:29 +01:00
Lukas Wirth
4284637e64 Base relative cargo configs onto the manifest
This is not correct, but should be equivalent in most cases
2024-12-31 14:52:00 +01:00
Lukas Wirth
fd4635c99c fix: Populate cargo config env vars for crates 2024-12-31 14:32:35 +01:00
Lukas Wirth
fb2ca58583 fix: Fix invalid -O flag used by cfg discovery 2024-12-29 16:04:17 +01:00
Lukas Wirth
98fde69dcf Inline toolchain_info module 2024-12-29 13:43:12 +01:00
Lukas Wirth
f5fb2b9e9f Force a current dir to be supplied for rustc info fetching 2024-12-29 13:26:04 +01:00
Lukas Wirth
8d2b12fe0e Split out ProjectWorkspace::load_cargo 2024-12-29 12:54:41 +01:00
Lukas Wirth
5ce14b0439 Enforce a current directory being set for spawned commands 2024-12-29 12:51:13 +01:00
Lukas Wirth
0f95e60da3 Cleanup toolchain info fetching 2024-12-29 12:25:51 +01:00
Lukas Wirth
e820c4da90 internal: Swallow error: config value is not set cargo error 2024-12-26 16:13:39 +01:00
Lukas Wirth
029261f9cc Cleanup target fetching for cargo metadata 2024-12-24 17:49:07 +01:00
Lukas Wirth
5211972743 internal: Split serde derive feature into serde_derive usage
Ideally we'd not have any dependency pull in the derive feature for faster build times, once that is the case this change would have an actual effect.
See https://github.com/matklad/macro-dep-test/blob/master/README.md for context.
2024-12-20 11:55:02 +01:00
Lukas Wirth
ab46e97188 fix: Fix sourceroot construction for virtual manifests 2024-12-12 12:58:18 +01:00
Lukas Wirth
7085328185 Remove patch sysroot cfg-if hack 2024-12-09 11:42:51 +01:00
Laurențiu Nicola
8d5e91c94f
Merge pull request #18511 from darichey/sysroot-query-metadata
Re-add `rust-analyzer.cargo.sysrootQueryMetadata`
2024-11-26 15:11:44 +00:00
Laurențiu Nicola
8fc5f3deb5 Fix missing rust-src message 2024-11-24 18:27:40 +02:00
David Richey
3c98b98ca7 Re-add rust-analyzer.cargo.sysrootQueryMetadata 2024-11-18 16:29:33 -06:00
Chayim Refael Friedman
074050c242 Support cfg(true) and cfg(false)
As per RFC 3695.
2024-10-27 10:46:49 +02:00
Lukas Wirth
e4a6efb9e0 internal: Improve proc-macro error msg for failed build scripts 2024-10-24 13:45:11 +02:00
Wilfred Hughes
3e51d145c3 fix: Add missing cfg flags for core crate
Some types in `core` are conditionally compiled based on
`target_has_atomic` or `target_has_atomic_load_store` without an
argument, for example `AtomicU64`.

This is less noticeable in Cargo projects, where rust-analyzer adds
the output `RUSTC_BOOTSTRAP=1 cargo rustc --print cfg` so it gets the
full set of cfg flags.

This fixes go-to-definition on `std::sync::atomic::AtomicU64` in
non-cargo projects.
2024-10-23 16:43:08 -07:00
Lukas Wirth
e5af3ae427 fix: Fix CI running analysis-stats incorrectly against the standard libraries 2024-10-18 12:34:55 +02:00
David Richey
eded3a8e29 Fix panic when json project has relative buildfile paths 2024-10-12 02:25:40 -05:00
Chayim Refael Friedman
4a06675e9c Gate #[test] expansion under cfg(test).
This will mean users opting to not activate `cfg(test)` will lose IDE experience on them, which is quite unfortunate, but this is unavoidable if we want to avoid false positives on e.g. diagnostics. The real fix is to provide IDE experience even for cfg'ed out code, but this is out of scope for this PR.
2024-09-30 00:12:45 +03:00
Chayim Refael Friedman
4ea09dd9f6 Provide an config option to not set cfg(test) 2024-09-30 00:12:45 +03:00
David Richey
85ca217765 Include buildfiles in vfs 2024-09-26 12:54:55 -04:00
Lukas Wirth
10ada02019 Pass all-targets for build scripts in more cli commands
Without this, build scripts don't run for tests and as such any proc-macros in dev-deps fail to resolve
2024-09-25 08:23:09 +02:00
Lukas Wirth
8905f86d8a Remove crate graph deduplication logic 2024-09-11 11:38:42 +02:00
Wilfred Hughes
3cf28f1fc6 fix: Updating settings should not clobber discovered projects
`linkedProjects` is owned by the user's configuration, so when users
update this setting, `linkedProjects` is reset. This is problematic when
`linkedProjects` also contains projects discovered with `discoverCommand`.

The buggy behaviour occurred when:

(1) The user configures `discoverCommand` and loads a Rust project.

(2) The user changes any setting in VS Code, so rust-analyzer receives
`workspace/didChangeConfiguration`.

(3) `handle_did_change_configuration` ultimately calls
`Client::apply_change_with_sink()`, which updates `config.user_config`
and discards any items we added in `linkedProjects`.

Instead, separate out `discovered_projects_from_filesystem` and
`discovered_projects_from_command` from user configuration, so user
settings cannot affect any type of discovered project.

This fixes the subtle issue mentioned here:
https://github.com/rust-lang/rust-analyzer/pull/17246#issuecomment-2185259122
2024-09-05 15:46:03 -07:00
Lukas Wirth
2e2f798a74 minor: Downgrade cyclic deps error to warning 2024-09-01 10:02:41 +02:00
Laurențiu Nicola
5f7bda743f Fix cwd used for proc macro expansion 2024-08-28 13:20:21 +03:00
bors
06a40a61b0 Auto merge of #17973 - Veykril:proc-macro-curr-dir, r=Veykril
Expand proc-macros in workspace root, not package root

Should fix https://github.com/rust-lang/rust-analyzer/issues/17748. The approach is generally not perfect though as rust-project.json projects don't benefit from this (still, nothing changes in that regard)
2024-08-27 11:53:04 +00:00
Lukas Wirth
9a47e6f2c8 Expand proc-macros in workspace root, not package root 2024-08-27 13:40:24 +02:00
bors
f4dbbac7ca Auto merge of #17956 - Veykril:metadata-err, r=Veykril
fix: Fix metadata retrying eating original errors
2024-08-25 07:30:09 +00:00
Lukas Wirth
191949eabe fix: Fix metadata retrying eating original errors 2024-08-25 09:28:47 +02:00
bors
ae420e353e Auto merge of #17857 - ChayimFriedman2:rust-project-cfg-group, r=Veykril
feat: Allow declaring cfg groups in rust-project.json, to help sharing common cfgs

Closes #17815.
2024-08-23 10:01:35 +00:00