Commit graph

255 commits

Author SHA1 Message Date
Lukas Wirth
5264f86242 Encode edition within FileId in the hir layer 2024-07-18 08:49:10 +02:00
Lukas Wirth
df5f1777b8 More symbol usage 2024-07-16 12:05:16 +02:00
Lukas Wirth
c30bdfcc84 Use symbol in cfg 2024-07-16 10:41:42 +02:00
mo8it
8ecfdec3c3 Remove version check before using --keep-going 2024-07-08 16:41:12 +02:00
Lukas Wirth
21a3d01875 Remove inline rust_2018_idioms, unused_lifetimes lint warn, Cargo.toml already enforces this 2024-06-30 15:23:54 +02:00
Wilfred Hughes
71a78a9cdc feature: add build system info; runnables to rust-project.json 2024-06-11 11:55:17 -04:00
Lukas Wirth
d4dc3ca83b Register virtual workspace Cargo.toml files in the VFS 2024-06-09 12:54:50 +02:00
Wilfred Hughes
27182bb96b chore: Prefer tracing span shorthand macros 2024-06-06 16:52:25 -07:00
Hamir Mahal
7c34eb3880
style: simplify string interpolation 2024-05-30 16:18:49 -07:00
Lukas Wirth
bd37e2790b Allow sysroots to only consist of the source root dir 2024-05-23 20:12:31 +02:00
Lukas Wirth
eac2e512a1 fix: Don't emit --keep-going for custom build script commands 2024-05-14 21:26:37 +02:00
Lukas Wirth
a268eaf053 fix: Correctly handle no_core/no_std for preludes 2024-05-02 10:50:28 +02:00
Lukas Wirth
18ca22a98e Show workspace info in the status bar 2024-04-26 11:28:33 +02:00
bors
e31c9f3fe1 Auto merge of #17102 - davidbarsky:david/add-some-tracing-to-project-loading, r=lnicola
chore: add some `tracing` to project loading

I wanted to see what's happening during project loading and if it could be parallelized. I'm thinking maybe, but it's not this PR :)
2024-04-22 15:56:06 +00:00
David Barsky
2a030ba755 chore: add some tracing to project loading 2024-04-22 11:39:01 -04:00
Lukas Wirth
fa754becc4 Support flychecking for cargo scripts 2024-04-21 17:40:17 +02:00
Lukas Wirth
ff56cb6e49 Extract common fields out of ProjectWorkspace variants 2024-04-21 17:03:02 +02:00
Lukas Wirth
a2ed6837bc Allow rust files to be used linkedProjects 2024-04-21 16:26:55 +02:00
Lukas Wirth
0ce7179e6b Correctly populate detached files roots 2024-04-19 18:25:10 +02:00
Lukas Wirth
46f05543a2 Patch cargo script root files back to manifest 2024-04-19 18:25:10 +02:00
Lukas Wirth
0b24599cf9 Re-implement dependecny tracking for cargo script 2024-04-19 18:25:06 +02:00
hkalbasi
2f828073aa Add minimal support for cargo scripts 2024-04-19 18:23:06 +02:00
Lukas Wirth
cdb8c3a327 Fix tests being non-deterministic 2024-04-19 13:22:00 +02:00
Lukas Wirth
0485a85ee2 Set debug_assertions and miri cfgs as config defaults, allowing them to be overwritten 2024-04-19 11:06:55 +02:00
Lukas Wirth
8989dcffd6 Support cfg overrides in all workspace kind 2024-04-19 10:59:32 +02:00
Lukas Wirth
ee10f9f5cd Cleanup cfg and env handling in project-model 2024-04-19 10:41:08 +02:00
Lukas Wirth
2e54c0af40 Remove rustc core test cfg hacks 2024-04-19 09:27:05 +02:00
Ali Bektas
67d8d2d4a0 Make ConfigData Ser and TOML De
This commit makes rust-analyzer::config module TOML ser and de.

Co-Authored-By: Cormac Relf <web@cormacrelf.net>
2024-04-15 14:14:23 +02:00
Lukas Wirth
f3567bb604 Arc CrateData::cfg_options 2024-04-06 13:55:10 +02:00
Lukas Wirth
600747a1b4 Fix patch_cfg_if not applying with stitched sysroot 2024-04-02 15:04:40 +02:00
bors
3691380c35 Auto merge of #16920 - Veykril:clippy-lints, r=Veykril
internal: Fix new nightly clippy lints
2024-04-01 16:00:18 +00:00
Lukas Wirth
2ae3e57c26 Fix new clippy lints 2024-04-01 17:55:56 +02:00
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